Constructors
constructor
- new LruMap<K, V>(
capacity: number,
MapImpl?: new <K, V>() => Map<K, TwoWayLinkedList<K, V>>,
): LruMap<K, V> Parameters
- capacity: number
- MapImpl: new <K, V>() => Map<K, TwoWayLinkedList<K, V>> = Map
Methods
clear
- clear(): void
Returns void
delete
- delete(key: K): void
Returns void
get
- get(key: K): undefined | V
Returns undefined | V
has
- has(key: K): boolean
Returns boolean
set
- set(key: K, value: V): void
Returns void
Simple class implementing LRU-like behaviour for a Map
Can be used to handle local cache of something
Uses two-way linked list internally to keep track of insertion/access order