voxolith

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

ParameterType
keystring

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

ParameterType
keystring

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

ParameterType
keystring
entityEntity
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

ParameterType
keystring
packedPackedEntity
info?{ generator?: string; }
info.generator?string

Returns

Promise<void>

On this page