(options?: {
readonly idleTimeToLive?: Duration.Input | undefined
})
| 2154 | * @since 4.2.0 |
| 2155 | */ |
| 2156 | export 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 |
nothing calls this directly
no test coverage detected