Hyperlinkv0.8.0-beta.28

ScopedCache

ScopedCache.invalidateAllconsteffect/ScopedCache.ts:683
<Key, A, E, R>(self: ScopedCache<Key, A, E, R>): Effect.Effect<void>

Removes every entry from the cache and closes each entry scope.

When to use

Use to clear a scoped cache and release resources owned by all cached entries.

Details

If the cache is closed, the effect is interrupted.

combinatorsinvalidate
export const invalidateAll = <Key, A, E, R>(self: ScopedCache<Key, A, E, R>): Effect.Effect<void> =>
  core.withFiber((parent) => {
    if (self.state._tag === "Closed") {
      return effect.interrupt
    }
    return invalidateAllImpl(parent, self.state.map)
  })