voxolith

ModelCacheControls

Developer controls for the model cache that serveGenerators({ cache }) fills, from openModelCacheControls. They run on the main thread (or anywhere with IndexedDB) and read only the small per-entry records, never the models. Nothing here runs by itself: the app decides when to inspect, clear or...

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

Developer controls for the model cache that serveGenerators({ cache }) fills, from openModelCacheControls. They run on the main thread (or anywhere with IndexedDB) and read only the small per-entry records, never the models. Nothing here runs by itself: the app decides when to inspect, clear or trim.

Methods

clear()

clear(filter?: ModelCacheFilter): Promise<number>;

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

Delete the entries matching filter (all of them without one). Resolves to how many went.

Parameters

ParameterType
filter?ModelCacheFilter

Returns

Promise<number>


close()

close(): void;

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

Close the database connection. The controls are unusable afterwards.

Returns

void


entries()

entries(filter?: ModelCacheFilter): Promise<ModelCacheEntry[]>;

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

Every entry matching filter, most recently used first.

Parameters

ParameterType
filter?ModelCacheFilter

Returns

Promise<ModelCacheEntry[]>


trim()

trim(maxBytes: number): Promise<number>;

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

Evict least recently used entries until the cache is at most maxBytes. Resolves to how many went.

Parameters

ParameterType
maxBytesnumber

Returns

Promise<number>


usage()

usage(filter?: ModelCacheFilter): Promise<{
  bytes: number;
  entries: number;
}>;

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

How many entries match filter and their approximate total bytes.

Parameters

ParameterType
filter?ModelCacheFilter

Returns

Promise<{ bytes: number; entries: number; }>

On this page