Interface CacheMap<K, V>

A CacheMap is a Map that notifies when an entry is evicted.

interface CacheMap<K, V> {
    onEvict: null | ((element: V, key: K, list: CacheMap<K, V>) => void);
}

Type Parameters

  • K
  • V

Hierarchy

  • Map<K, V>
    • CacheMap

Implemented by

Properties

Properties

onEvict: null | ((element: V, key: K, list: CacheMap<K, V>) => void)

When an entry is added when at capacity, the least recently used entry will be removed. This callback can be set to be notified with the element and key being evicted, which may be used for disposal.