MCPcopy Index your code
hub / github.com/Effect-TS/effect / set

Method set

packages/effect/src/internal/cache.ts:502–521  ·  view source on GitHub ↗
(key: Key, value: Value)

Source from the content-addressed store, hash-verified

500 }
501
502 set(key: Key, value: Value): Effect.Effect<void> {
503 return effect.clockWith((clock) =>
504 core.sync(() => {
505 const now = clock.unsafeCurrentTimeMillis()
506 const k = key
507 const lookupResult = Exit.succeed(value)
508 const mapValue = complete(
509 makeMapKey(k),
510 lookupResult,
511 makeEntryStats(now),
512 now + Duration.toMillis(Duration.decode(this.timeToLive(lookupResult)))
513 )
514 MutableHashMap.set(
515 this.cacheState.map,
516 k,
517 mapValue as Complete<Key, Value, Error>
518 )
519 })
520 )
521 }
522
523 get size(): Effect.Effect<number> {
524 return core.sync(() => {

Callers

nothing calls this directly

Calls 7

makeMapKeyFunction · 0.85
makeEntryStatsFunction · 0.85
syncMethod · 0.80
decodeMethod · 0.80
completeFunction · 0.70
setMethod · 0.65

Tested by

no test coverage detected