memoize
memoize<
A,B>(f,options?): (a) =>B
Defined in: Composition/memoize.ts:34
Creates a memoized version of a function that caches results. Subsequent calls with the same argument return the cached result.
By default, uses the argument directly as the cache key.
For complex arguments, provide a custom keyBy to generate cache keys.
Type Parameters
Section titled “Type Parameters”A
B
Parameters
Section titled “Parameters”(a) => B
options?
Section titled “options?”keyBy?
Section titled “keyBy?”(a) => unknown
Maps an argument to the value used as its cache key. Defaults to the argument itself.
maxSize?
Section titled “maxSize?”number
Maximum number of entries to store before evicting the least recently used entry.
Fractional values are floored; 0 disables caching; Infinity means unbounded.
Negative or NaN values disable caching.
Returns
Section titled “Returns”(a) => B