Skip to main content

Class: CacheUtils

Defined in: core/src/CacheUtils.ts:11

Utility functions for working with bounded in-memory caches.

Constructors

Constructor

new CacheUtils(): CacheUtils

Returns

CacheUtils

Methods

evictOldest()

static evictOldest<K, V>(map, num?): void

Defined in: core/src/CacheUtils.ts:19

Evicts the oldest inserted entry from map, if any. A Map preserves insertion order, so this removes whatever entry was set() least recently among those still present.

Type Parameters

K

K

V

V

Parameters

map

Map<K, V>

The map to evict the oldest entry from.

num?

number = 1

The total number of items to evict. Default is 1.

Returns

void