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

Function computeCachedValue

packages/effect/src/internal/effect/circular.ts:263–274  ·  view source on GitHub ↗
(
  self: Effect.Effect<A, E, R>,
  timeToLive: Duration.DurationInput,
  start: number
)

Source from the content-addressed store, hash-verified

261
262/** @internal */
263const computeCachedValue = <A, E, R>(
264 self: Effect.Effect<A, E, R>,
265 timeToLive: Duration.DurationInput,
266 start: number
267): Effect.Effect<Option.Option<[number, Deferred.Deferred<A, E>]>, never, R> => {
268 const timeToLiveMillis = Duration.toMillis(Duration.decode(timeToLive))
269 return pipe(
270 core.deferredMake<A, E>(),
271 core.tap((deferred) => core.intoDeferred(self, deferred)),
272 core.map((deferred) => Option.some([start + timeToLiveMillis, deferred]))
273 )
274}
275
276/** @internal */
277const getCachedValue = <A, E, R>(

Callers 1

getCachedValueFunction · 0.85

Calls 3

decodeMethod · 0.80
pipeFunction · 0.70
mapMethod · 0.65

Tested by

no test coverage detected