Optionaloptions: { maxSize?: number; ttl?: number }OptionalmaxSize?: numberWhen set, evicts the least-recently-used entry once the cache exceeds this size.
Optionalttl?: numberTime-to-live in milliseconds. Entries older than this are recomputed on read.
Caches the result of a function call by its arguments.
Returned function exposes
.clear()and.delete(...args)for manual invalidation. OptionalmaxSizeenables LRU eviction; optionalttl(ms) makes entries expire. Promises are unwrapped — only the resolved value is stored, so concurrent calls share one inflight Promise.