ModelCache
Generated models kept in IndexedDB, from openModelCache. Both methods swallow storage errors: a failed get is a miss and a failed put simply keeps nothing.
Defined in: engine/src/worker/cache.ts:26
Methods
get()
get(key: string): Promise<Entity | undefined>;Defined in: engine/src/worker/cache.ts:28
The entity stored under key, as fresh arrays, or undefined. A hit marks the entry used now (for the size cap's eviction).
Parameters
| Parameter | Type |
|---|---|
key | string |
Returns
Promise<Entity | undefined>
getPacked()
getPacked(key: string): Promise<PackedEntity | undefined>;Defined in: engine/src/worker/cache.ts:34
The entity stored under key in its packed form (packEntity), or undefined: what
serveGenerators posts, since one buffer transfers where a sparse model's thousands of
brick buffers are slow to. A hit marks the entry used now.
Parameters
| Parameter | Type |
|---|---|
key | string |
Returns
Promise<PackedEntity | undefined>
put()
put(
key: string,
entity: Entity,
info?: object
): Promise<void>;Defined in: engine/src/worker/cache.ts:40
Store a packed, deflated copy. It copies before its first await, so the caller may transfer
the entity's buffers straight after calling. Resolves once the write has committed (or
failed). info.generator is recorded for inspecting and clearing by generator.
Parameters
| Parameter | Type |
|---|---|
key | string |
entity | Entity |
info? | { generator?: string; } |
info.generator? | string |
Returns
Promise<void>
putPacked()
putPacked(
key: string,
packed: PackedEntity,
info?: object
): Promise<void>;Defined in: engine/src/worker/cache.ts:42
ModelCache.put for an entity already packed; it copies packed.bytes before its first await.
Parameters
| Parameter | Type |
|---|---|
key | string |
packed | PackedEntity |
info? | { generator?: string; } |
info.generator? | string |
Returns
Promise<void>
GeneratorPoolOptions
Options for makeGeneratorPool.
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...