import "@effect-ts/system/Operator"; import * as T from "@effect-ts/core/Effect"; import * as E from "@effect-ts/core/Either"; import * as O from "@effect-ts/core/Option"; import * as REF from "@effect-ts/system/Ref"; import type { Request } from "../Request/index.js"; /** * A `Cache` maintains an internal state with a mapping from requests to `Ref`s * that will contain the result of those requests when they are executed. This * is used internally by the library to provide deduplication and caching of * requests. */ export interface Cache { /** * Looks up a request in the cache, failing with the unit value if the * request is not in the cache, succeeding with `Ref(None)` if the request is * in the cache but has not been executed yet, or `Ref(Some(value))` if the * request has been executed. */ get(request: Request): T.IO>>>; /** * Looks up a request in the cache. If the request is not in the cache * returns a `Left` with a `Ref` that can be set with a `Some` to complete * the request. If the request is in the cache returns a `Right` with a `Ref` * that either contains `Some` with a result if the request has been executed * or `None` if the request has not been executed yet. */ lookup(request: Request): T.UIO>>, REF.Ref>>>>; /** * Inserts a request and a `Ref` that will contain the result of the request * when it is executed into the cache. */ put(request: Request, result: REF.Ref>>): T.UIO; /** * Removes a request from the cache. */ remove(request: Request): T.UIO; } export declare const empty: T.Effect; //# sourceMappingURL=index.d.ts.map