Skip to content

Interface: KeyValueCache<V>

API / @xmachines/core / cache / KeyValueCache

Defined in: packages/core/src/cache.ts:17

What a reader needs from a cache: a read and a write, both by a string key.

A cache may forget an entry at any time, and it may forget none. Both are correct for a reader that computes the value again for an entry that is absent.

Type Parameters

Type Parameter
V

Methods

get()

get(key): V | undefined;

Defined in: packages/core/src/cache.ts:19

Reads one entry, or undefined when the cache holds none for the key.

Parameters

ParameterType
keystring

Returns

V | undefined


set()

set(key, value): void;

Defined in: packages/core/src/cache.ts:21

Writes one entry.

Parameters

ParameterType
keystring
valueV

Returns

void