LRUDictionary<K, V> Class

A LRUCache using a Dictionary as its internal storage, permitting custom key comparison logic.

Extends

Methods

Name Description
constructor<K, V>(limit: number, compareKeys: OrderedComparator<K>): LRUDictionary<K, V> Construct a new LRUDictionary to hold up to limit entries.  

Inherited methods

Name Inherited from Description
assign(entries: Iterable<[K, V], any, any>): void Inherited LRUCache<K, V> Replace all values in this cache with key-value pairs (2-element Arrays) from provided iterable.
clear(): void Inherited LRUCache<K, V> Removes all entries
delete(key: K): undefined | V Inherited LRUCache<K, V> Remove entry key from cache and return its value.
entries(): undefined | Iterator<undefined | [K, V], any, any> Inherited LRUCache<K, V> Returns an iterator over all entries, starting with the oldest.
find(key: K): undefined | V Inherited LRUCache<K, V> Access value for key without registering recent use.
forEach(fun: (value: V, key: K, m: LRUCache<K, V>) => void, thisObj?: any): void Inherited LRUCache<K, V> Call fun for each entry, starting with the oldest entry.
get(key: K): undefined | V Inherited LRUCache<K, V> Get and register recent use of .
has(key: K): boolean Inherited LRUCache<K, V> Check if there's a value for key in the cache without registering recent use.
keys(): undefined | Iterator<undefined | K, any, any> Inherited LRUCache<K, V> Returns an iterator over all keys, starting with the oldest.
set(key: K, value: V): LRUCache<K, V> Inherited LRUCache<K, V> Put into the cache associated with .
shift(): undefined | [K, V] Inherited LRUCache<K, V> Purge the least recently used (oldest) entry from the cache.
toJSON(): { key: K, value: V }[] Inherited LRUCache<K, V> Returns a JSON (array) representation
toString(): string Inherited LRUCache<K, V> Returns a String representation
values(): undefined | Iterator<undefined | V, any, any> Inherited LRUCache<K, V> Returns an iterator over all values, starting with the oldest.

Inherited properties

Name Type Inherited from Description
limit Inherited number LRUCache<K, V> Maximum number of items this cache can hold
newest Inherited Entry<K, V> | undefined LRUCache<K, V> Most recently-used entry.
oldest Inherited Entry<K, V> | undefined LRUCache<K, V> Least recently-used entry.
size Inherited number LRUCache<K, V> Current number of items

Defined in

Last Updated: 14 November, 2024