openModelCache()
The model cache in IndexedDB database name, or null where there is none (bun, some private windows, a database an older build in another tab holds open). Used by serveGenerators in the worker; entries stored under any other salt are deleted when it opens, so a new build frees the old build's models.
function openModelCache(
name: string,
salt: string,
opts?: ModelCacheOptions
): Promise<ModelCache | null>;Defined in: engine/src/worker/cache.ts:438
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The database name (the same one given to serveGenerators({ cache })). |
salt | string | Prefixed to every key; the worker passes its script URL. |
opts? | ModelCacheOptions | An optional size cap. |
Returns
Promise<ModelCache | null>
memoryCacheStore()
A CacheStore in memory, for tests and for hosts without IndexedDB.
openModelCacheControls()
Open controls for the model cache in IndexedDB database name (the name given to serveGenerators({ cache })), or null where there is no IndexedDB. Works from the main thread while workers use the cache.