import type { Cache as _Cache } from "../vendor/Cache/Cache.js" import { make as _make } from "../vendor/Cache/Cache.js" import type { CacheState } from "../vendor/Cache/Cache/_internal/CacheState.js" import type { Lookup } from "../vendor/Cache/Lookup.js" /** * @tsplus type ets/cache/Cache */ export interface Cache extends _Cache {} /** * @tsplus type ets/cache/CacheOps */ // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface CacheOps {} export const Cache: CacheOps = {} /** * @tsplus static ets/cache/CacheOps make */ export function make( capacity: number, duration: DUR, lookup: Lookup ) { return _make(capacity, duration, lookup) as Effect> } /** * @tsplus getter ets/cache/Cache results */ export function results( self: Cache ): Effect]>> { return Effect(() => { const values: Array<[Key, Exit]> = [] for (const [key, value] of ((self as any).cacheState as CacheState).map) { if (value._tag === "Complete") { values.push([key, value.exit]) } } return Chunk.fromIterable(values) }) }