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

Function layer

packages/effect/src/ui/Query.ts:2156–2172  ·  view source on GitHub ↗
(options?: {
  readonly idleTimeToLive?: Duration.Input | undefined
})

Source from the content-addressed store, hash-verified

2154 * @since 4.2.0
2155 */
2156export const layer = (options?: {
2157 readonly idleTimeToLive?: Duration.Input | undefined
2158}): Layer.Layer<Cache> => {
2159 const idleMs = cacheIdleMs(options?.idleTimeToLive)
2160 return Layer.effect(
2161 Cache,
2162 Effect.gen(function*() {
2163 const context = yield* Effect.context<never>()
2164 return yield* makeCache({
2165 idleMs,
2166 visibility: Context.get(context, Visibility),
2167 connectivity: Context.get(context, Connectivity),
2168 report: Context.get(context, Problems)
2169 })
2170 })
2171 )
2172}
2173
2174// =============================================================================
2175// Internals

Callers

nothing calls this directly

Calls 4

cacheIdleMsFunction · 0.85
contextMethod · 0.80
makeCacheFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected