Aller au contenu principal

Cache<K, V>

Generic cache interface for type-safe cache operations.

Since

2.0.0


Type Parameters

K: K

The key type.

V: V

The value type.


Properties

size: number

The number of entries in the cache.


Methods

get()

Retrieves a value from the cache, or undefined if not found.

key: K
Returns: V | undefined

set()

Stores a value in the cache.

key: K
value: V
Returns: void

has()

Checks if a key exists in the cache.

key: K
Returns: boolean

delete()

Removes a key from the cache.

key: K
Returns: boolean

clear()

Clears all entries from the cache.

Returns

void