voxolith

openSceneCacheControls()

Open controls for the scene cache in IndexedDB database name (the name given to serveScene({ cache })), or null where there is no IndexedDB. Works from the main thread while the worker uses the cache. As with openModelCacheControls, nothing is cleared or trimmed unless the app asks (apart from...

function openSceneCacheControls(name: string): Promise<SceneCacheControls | null>;

Defined in: engine/src/worker/scene-cache.ts:378

Open controls for the scene cache in IndexedDB database name (the name given to serveScene({ cache })), or null where there is no IndexedDB. Works from the main thread while the worker uses the cache. As with openModelCacheControls, nothing is cleared or trimmed unless the app asks (apart from the worker dropping an older build's entries, and a maxBytes cap if the worker was given one).

Parameters

ParameterType
namestring

Returns

Promise<SceneCacheControls | null>

Example

const scene = await openSceneCacheControls("voxolith-scene");
if (scene) {
  const { bytes } = await scene.usage({ kind: "placement" });
  console.log(`bakes: ${(bytes / 1e6).toFixed(1)} MB`);
  await scene.clear({ kind: "placement" });
  scene.close();
}

On this page