Class QuickLRU<KeyType, ValueType>
Type Parameters
Index
Constructors
Accessors
Methods
Properties
Accessors
maxSize
- get maxSize(): number
The set max size.
Returns number
size
- get size(): number
The stored item count.
Returns number
Methods
[iterator]
- [iterator](): IterableIterator<[KeyType, ValueType], any, any>
Returns IterableIterator<[KeyType, ValueType], any, any>
clear
delete
- delete(key): boolean
Delete an item.
Parameters
- key: KeyType
Returns boolean
true
if the item is removed orfalse
if the item doesn't exist.
entries
- entries(): MapIterator<[KeyType, ValueType]>
Returns an iterable of key, value pairs for every entry in the map.
Returns MapIterator<[KeyType, ValueType]>
entriesAscending
- entries
Ascending (): IterableIterator<[KeyType, ValueType], any, any> Iterable for all entries, starting with the oldest (ascending in recency).
Returns IterableIterator<[KeyType, ValueType], any, any>
entriesDescending
- entries
Descending (): IterableIterator<[KeyType, ValueType], any, any> Iterable for all entries, starting with the newest (descending in recency).
Returns IterableIterator<[KeyType, ValueType], any, any>
forEach
get
has
- has(key): boolean
Check if an item exists.
Parameters
- key: KeyType
Returns boolean
keys
- keys(): IterableIterator<KeyType, any, any>
Iterable for all the keys.
Returns IterableIterator<KeyType, any, any>
peek
resize
set
- set(key, value, options?): this
Set an item. Returns the instance.
Individual expiration of an item can be specified with the
maxAge
option. If not specified, the globalmaxAge
value will be used in case it is specified in the constructor, otherwise the item will never expire.Returns this
The list instance.
values
- values(): IterableIterator<ValueType, any, any>
Iterable for all the values.
Returns IterableIterator<ValueType, any, any>
Simple "Least Recently Used" (LRU) cache.
The instance is an
Iterable
of[key, value]
pairs so you can use it directly in aforβ¦of
loop.