Internal
Private
#privateLRUCache.OptionsBase.allowStale
LRUCache.OptionsBase.allowStaleOnFetchAbort
LRUCache.OptionsBase.allowStaleOnFetchRejection
LRUCache.OptionsBase.ignoreFetchAbort
LRUCache.OptionsBase.maxEntrySize
LRUCache.OptionsBase.noDeleteOnFetchRejection
LRUCache.OptionsBase.noDeleteOnStaleGet
LRUCache.OptionsBase.noDisposeOnSet
LRUCache.OptionsBase.noUpdateTTL
Optional
sizeLRUCache.OptionsBase.sizeCalculation
LRUCache.OptionsBase.ttl
LRUCache.OptionsBase.ttlAutopurge
LRUCache.OptionsBase.ttlResolution
LRUCache.OptionsBase.updateAgeOnGet
LRUCache.OptionsBase.updateAgeOnHas
The total computed size of items in the cache (read-only)
LRUCache.OptionsBase.dispose (read-only)
LRUCache.OptionsBase.disposeAfter (read-only)
LRUCache.OptionsBase.fetchMethod (read-only)
LRUCache.OptionsBase.max (read-only)
LRUCache.OptionsBase.maxSize (read-only)
The number of items stored in the cache (read-only)
Make an asynchronous cached fetch using the LRUCache.OptionsBase.fetchMethod function.
If multiple fetches for the same key are issued, then they will all be coalesced into a single call to fetchMethod.
Note that this means that handling options such as LRUCache.OptionsBase.allowStaleOnFetchAbort, LRUCache.FetchOptions.signal, and LRUCache.OptionsBase.allowStaleOnFetchRejection will be determined by the FIRST fetch() call for a given key.
This is a known (fixable) shortcoming which will be addresed on when someone complains about it, as the fix would involve added complexity and may not be worth the costs for this edge case.
Optional
fetchOptions: FetchOptions<string, string, unknown>Find a value for which the supplied fn method returns a truthy value, similar to Array.find(). fn is called as fn(value, key, cache).
Optional
getOptions: GetOptions<string, string, unknown>Call the supplied function on each item in the cache, in order from most recently used to least recently used. fn is called as fn(value, key, cache). Does not update age or recenty of use. Does not iterate over stale values.
Optional
thisp: anyReturn a value from the cache. Will update the recency of the cache entry found.
If the key is not found, get() will return undefined
.
Optional
getOptions: GetOptions<string, string, unknown>Check if a key is in the cache, without updating the recency of use. Will return false if the item is stale, even though it is technically in the cache.
Will not update item age unless LRUCache.OptionsBase.updateAgeOnHas is set.
Optional
hasOptions: HasOptions<string, string, unknown>Like LRUCache#get but doesn't update recency or delete stale items.
Returns undefined
if the item is stale, unless
LRUCache.OptionsBase.allowStale is set.
Optional
peekOptions: PeekOptions<string, string, unknown>Inverse order version of LRUCache.entries
Return a generator yielding [key, value]
pairs,
in order from least recently used to most recently used.
The same as LRUCache.forEach but items are iterated over in reverse order. (ie, less recently used items are iterated over first.)
Optional
thisp: anyInverse order version of LRUCache.values
Return a generator yielding the values in the cache, in order from least recently used to most recently used.
Add a value to the cache.
Note: if undefined
is specified as a value, this is an alias for
LRUCache#delete
Optional
setOptions: SetOptions<string, string, unknown>Static
unsafeInternal
Do not call this method unless you need to inspect the inner workings of the cache. If anything returned by this object is modified in any way, strange breakage may occur.
These fields are private for a reason!
Readonly
head: IndexOptional
options: { Optional
options: { Readonly
tail: IndexGenerated using TypeDoc
An LRUCache for storing resolved path strings or Path objects.