LRUMap<K, V> Class

A LRUCache using a standard Map as its internal storage.

Extends

Methods

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

Inherited methods

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

Inherited properties

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

Defined in

Last Updated: 12 June, 2024