Skip to content

Interface: PatternCache<V>

API / @xmachines/play-router / index / PatternCache

Defined in: packages/play-pattern/src/cache.ts:53

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

The contract is this small on purpose. A Map satisfies it, and so does an LRU of any library — a caller that wants a time to live or an eviction callback brings the module that has one, and this package needs to know nothing about it.

A cache may forget an entry at any time, and it may forget none. Both are correct: the parser runs again for an entry that is absent.

Type Parameters

Type Parameter
V

Methods

get()

get(key): V | undefined;

Defined in: packages/play-pattern/src/cache.ts:55

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/play-pattern/src/cache.ts:57

Writes one entry.

Parameters

ParameterType
keystring
valueV

Returns

void