MCPcopy Create free account
hub / github.com/Effect-TS/effect / invalidate

Method invalidate

packages/effect/src/internal/scopedCache.ts:308–327  ·  view source on GitHub ↗
(key: Key)

Source from the content-addressed store, hash-verified

306 }
307
308 invalidate(key: Key): Effect.Effect<void> {
309 return core.suspend(() => {
310 if (MutableHashMap.has(this.cacheState.map, key)) {
311 const mapValue = Option.getOrUndefined(MutableHashMap.get(this.cacheState.map, key))!
312 MutableHashMap.remove(this.cacheState.map, key)
313 switch (mapValue._tag) {
314 case "Complete": {
315 return releaseOwner(mapValue)
316 }
317 case "Pending": {
318 return core.void
319 }
320 case "Refreshing": {
321 return releaseOwner(mapValue.complete)
322 }
323 }
324 }
325 return core.void
326 })
327 }
328
329 get invalidateAll(): Effect.Effect<void> {
330 return fiberRuntime.forEachConcurrentDiscard(

Callers 1

invalidateAllMethod · 0.95

Calls 3

releaseOwnerFunction · 0.85
getMethod · 0.65
removeMethod · 0.65

Tested by

no test coverage detected