/** * Entries a {@link createBoundedMemo} keeps before evicting. * * Sized for per-locale caches. A browser holds one or two locales and never * gets near it. A server that takes the locale from `Accept-Language` is keyed * by whatever tags clients send — an unknown or malformed tag still earns its * own entry — so without a ceiling the process grows for as long as it runs. * 100 is far above any real per-process locale count. */ export declare const DEFAULT_MEMO_LIMIT = 100; /** A memoized function, plus a way to empty it for test isolation. */ export interface BoundedMemo { (...args: Args): Value; /** @internal — test-only. Drops every cached entry. */ clear(): void; } /** * Caches `build` under `keyOf`, keeping at most `limit` entries and evicting * the least recently used one past that. * * Least-recently-used rather than first-in-first-out because callers may * depend on the result's identity — Calendar's weekday labels feed a `useMemo` * dependency list, so evicting a value still in use would rebuild it with a new * identity and re-render everything below. Touching an entry moves it out of * the eviction queue, so anything in active use stays put. * * Past the limit the failure is a cliff, not a slope: a working set larger than * `limit` evicts every entry just before it is next needed and the hit rate * drops to zero. Keep one entry per logical key — don't fold variants into the * key of a single memo, which quietly divides the headroom — and raise the * limit rather than let a plausible workload sit just above it. */ export declare const createBoundedMemo: (keyOf: (...args: Args) => string, build: (...args: Args) => Value, limit?: number) => BoundedMemo;