import * as z from 'zod'; export interface CacheOptions { /** Maximum number of items the cache can hold */ itemLimit: number; /** @todo replace with `Temporal.DurationLike` */ ttl: number; } export declare const CacheData: z.ZodRecord; }, z.core.$loose>>; /** @todo replace `$timestamp` with `Temporal.InstantLike` */ export interface CacheData extends Record { } declare const kTimestamp: unique symbol; /** * Cache some arbitrary operation. * This is primarily intended for de-duplicating API requests */ export declare class Cache { /** * Function to run when there is a cache miss * @ */ protected readonly miss: (...keys: Keys) => V | Promise; protected items: Map; protected pending: Map>; readonly options: CacheOptions; private onWrite?; constructor( /** * Function to run when there is a cache miss * @ */ miss: (...keys: Keys) => V | Promise, options?: Partial); protected key(keys: Keys): string; get size(): number; protected valid(timestamp?: number): boolean; protected write(key: string, value: V | Promise): void; get(...keys: Keys): V | Promise; set(...args: [...keys: Keys, value: V | Promise]): void; invalidate(...keys: Keys): void; persist(onWrite: (data: CacheData) => void, /** @todo replace `$timestamp` with `Temporal.InstantLike` */ existingContent?: Record): void; toJSON(): CacheData; } export default Cache;