voxolith

makeModelCache()

The model cache on any CacheStore: keys are prefixed with salt, entries are deflated, and maxBytes evicts by last use after each write. openModelCache is this on IndexedDB. Throws a RangeError on a maxBytes that is not a positive finite number, and warns about doubtful ones...

function makeModelCache(
   store: CacheStore, 
   salt: string, 
   opts?: ModelCacheOptions, 
   now?: () => number
): ModelCache;

Defined in: engine/src/worker/cache.ts:373

The model cache on any CacheStore: keys are prefixed with salt, entries are deflated, and maxBytes evicts by last use after each write. openModelCache is this on IndexedDB. Throws a RangeError on a maxBytes that is not a positive finite number, and warns about doubtful ones (ModelCacheOptions.maxBytes).

Parameters

ParameterTypeDefault valueDescription
storeCacheStoreundefined-
saltstringundefined-
opts?ModelCacheOptions{}-
now?() => numberDate.nowThe clock for created / lastUsed (default Date.now); tests pass their own.

Returns

ModelCache

On this page