Validate limits and policy callbacks; allocate entry storage lazily on admission.
Number of currently retained entries.
Return a new frozen snapshot of usage and limits.
Total estimated retained bytes, including keys and entry overhead.
Remove all entries and release the backing cache.
Remove an entry and its accounted bytes; return whether it existed.
Read a value and mark an existing entry most recently used.
Read and refresh an existing entry, including undefined, or synchronously create it. The factory receives the key and runs only on a miss, even when retention is disabled. On a miss return the computed value, even if admission is rejected or detach stores a separate copy. Factory and policy errors propagate; callbacks must not mutate this cache. Promise values are stored as-is, without awaiting or retrying them.
Test membership without refreshing recency.
Iterate keys from least to most recently used without refreshing recency.
Read a value without refreshing recency; missing keys return undefined.
Chainable insertion; use trySet to observe admission or rejection.
Rejection or callback failure does not replace, evict, or refresh existing entries.
StaticcreateOptional owner storage: returns undefined when either validated limit is zero.
String-keyed LRU with estimated byte accounting, not a heap-memory guarantee. Cost = entry overhead + two bytes per UTF-16 key code unit + measured payload. Values remain caller-owned unless detach is supplied; do not mutate retained values in a way that changes their measured size. Callbacks are synchronous.