import type { UsageLedger } from "./usage-ledger.js"; export interface UsageCacheOptions { /** How long a window's total may be reused. Default 2 000 ms. */ ttlMs?: number; /** * Cap on remembered windows. Beyond it the expired entries are dropped, and if * that is not enough the cache is cleared outright. * * A bound is needed because the key includes the window, so a long-running * process accumulates one entry per window per caller for ever. Clearing is * safe — the next read simply goes to the ledger — whereas an unbounded map is * a slow leak that only shows up in production. */ maxEntries?: number; } /** * Wrap a ledger so repeated reads of the same window inside `ttlMs` cost one * request instead of one per call. * * ```ts * const ledger = cachedUsageLedger( * stripeUsageLedger({ perCaller: stripeScopeUsageLedger() }), * { ttlMs: 2_000 }, * ); * ``` * * `covers` is inherited unchanged: caching does not alter WHICH windows the * underlying ledger can see, only how often it is asked. */ export declare function cachedUsageLedger(inner: UsageLedger, opts?: UsageCacheOptions): UsageLedger; //# sourceMappingURL=usage-cache.d.ts.map