Skip to main content

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