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

Function makeWithTTL

packages/effect/src/internal/pool.ts:89–103  ·  view source on GitHub ↗
(options: {
  readonly acquire: Effect<A, E, R>
  readonly min: number
  readonly max: number
  readonly concurrency?: number | undefined
  readonly targetUtilization?: number | undefined
  readonly timeToLive: Duration.DurationInput
  readonly timeToLiveStrategy?: "creation" | "usage" | undefined
})

Source from the content-addressed store, hash-verified

87
88/** @internal */
89export const makeWithTTL = <A, E, R>(options: {
90 readonly acquire: Effect<A, E, R>
91 readonly min: number
92 readonly max: number
93 readonly concurrency?: number | undefined
94 readonly targetUtilization?: number | undefined
95 readonly timeToLive: Duration.DurationInput
96 readonly timeToLiveStrategy?: "creation" | "usage" | undefined
97}): Effect<Pool<A, E>, never, R | Scope> =>
98 core.flatMap(
99 options.timeToLiveStrategy === "creation" ?
100 strategyCreationTTL<A, E>(options.timeToLive) :
101 strategyUsageTTL<A, E>(options.timeToLive),
102 (strategy) => makeWith({ ...options, strategy })
103 )
104
105/** @internal */
106export const get = <A, E>(self: Pool<A, E>): Effect<A, E, Scope> => self.get

Callers

nothing calls this directly

Calls 3

strategyCreationTTLFunction · 0.85
strategyUsageTTLFunction · 0.85
makeWithFunction · 0.70

Tested by

no test coverage detected