Implements a Least Recently Used fixed-capacity cache which supports updating, removing, and accessing keys in O(1).
V
Creates a new instance of fixed size.
Protected
Returns the total capacity of the cache.
Returns the total number of elements in the cache.
This is just an alias of set.
The key to add (note value will be undefined)
undefined
Removes all keys and values from the cache.
Returns true if the specified key is found on the cache.
true
key
Removes a key from the cache and returns true if the key existed or false otherwise.
false
true if the key existed and was removed
Check if there are no items.
true if is empty.
Returns an iterable of all the [key, value] pairs in the cache, in insertion order.
Get the value associated with the specified key, or undefined it not found.
The associated value or undefined
Returns an iterable of all the keys in the cache, in insertion order.
Removes the value associated with the specified key from the cache and returns the removed value if the key existed.
The value if it was removed or undefined.
Adds a new element with a specified key and value to the cache. If an element with the same key already exists, the element will be updated.
value
Returns an iterable of all the values in the cache, in insertion order.
Generated using TypeDoc
Implements a Least Recently Used fixed-capacity cache which supports updating, removing, and accessing keys in O(1).
Template
V