export interface TtlCacheOptions { /** Entry lifetime in ms. Defaults to no expiry. */ ttl?: number; /** Evict past this many entries. Defaults to unbounded. */ maxEntries?: number; /** Promote an entry to most-recently-used on `get`, so eviction drops the least recently used. Defaults to insertion order (FIFO). */ lru?: boolean; } export interface TtlCache { get: (key: K) => V | undefined; peek: (key: K) => V | undefined; has: (key: K) => boolean; set: (key: K, value: V) => void; delete: (key: K) => boolean; clear: () => void; readonly size: number; getOrLoad: (key: K, loader: (key: K) => Promise) => Promise; /** Live entries in eviction order (first out first). */ [Symbol.iterator]: () => IterableIterator<[K, V]>; } /** In-memory TTL cache with optional size-based eviction, FIFO by default or LRU via `options.lru`. */ export declare function createTtlCache(options?: TtlCacheOptions): TtlCache; export interface MemoizeOptions extends TtlCacheOptions { /** Cache key for a call. Defaults to `JSON.stringify(args)`. */ key?: (...args: A) => string; } export type Memoized = ((...args: A) => R) & { cache: TtlCache; }; /** * Wrap `fn` in a TTL cache keyed by its arguments. A returned promise is cached as-is, * so concurrent calls share one in-flight run and a rejection evicts the entry. */ export declare function memoize(fn: (...args: A) => R, options?: MemoizeOptions): Memoized; //# sourceMappingURL=cache.d.ts.map