Skip to content

RequestCache

new RequestCache(options?): RequestCache

CacheOptions = {}

RequestCache

getOrCreate<T>(key, factory, signal?): Promise<T>

Resolves key via factory (given the shared signal) unless already cached or in flight.

T

string

(signal) => Promise<T>

AbortSignal

Promise<T>


has(key): boolean

string

boolean


invalidate(key?): void

Drops one key, or everything.

string

void


seed(key, value): void

Inserts an already-settled entry (cache seeding) — a response that already contains an expanded child primes that child’s own cache entry, so a later resolveReference/traversal for it is a hit with no network request. Participates in LRU like any fetched entry. Overwrites whatever was there (an in-flight entry’s own already-issued promises are unaffected — they hold their own reference — only future lookups for the key see the seeded value).

string

unknown

void