Optional
cloneOptional
cloneCustom function to be used with the clone
option. If not passed, JSON.parse(JSON.stringify(value))
is used for cloning objects.
Optional
entryThe time to live for cache entries. Setting this to null
will make entries never expire. Default value is null
.
Optional
maxThe max number of items the cache can hold. Once the cache reaches this number, the least recently used entries will start to be evicted to make room for new entries. Defaults to 25.
Optional
onFunction to be called whenever an entry is evicted from the cache (when evicted due to needing to make room, is expired, or deleted using delete()). Passed argument is an object:
{
key: TKey;
value: TValue;
isExpired: boolean;
}
Optional
onFunction to be called whenever an entry is marked as recently used (on set, get, find, etc). Passed argument is an object:
{
key: TKey;
value: TValue;
}
Generated using TypeDoc
Clone values being set and fetched from the cache (clones on set and any retrievals). Useful to maintain immutability. NOTE! This does come with performance overhead (almost twice as slow). Defaults to false.