LRUCache
Source: LRUCache.ts:8
Least recently used cache of a limited number of entries. Map keeps the insertion order, so the first key is always the least recently used one.
Constructor
new LRUCache(capacity: number, onEvict?: function): LRUCacheParameters
capacity(number) — Maximal number of entries.onEvict(function, optional) — Called with the entries removed to free the place for new ones.
Instance Methods
get()
Returns the value and makes it the most recently used.
peek()
Returns the value without making it the most recently used.
set()
Sets the most recently used value, the least recently used ones over the capacity are evicted.
values()
Returns the values from the least to the most recently used, without making them used.
delete()
Removes the entry, not counted as an eviction.
clear()
Removes all the entries, not counted as evictions.