voxolith

ModelCacheOptions

Options for openModelCache.

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

Extended by

Properties

PropertyTypeDescriptionDefined in
maxBytes?numberKeep the cache under about this many bytes (compressed): after each write, the least recently used entries (of any salt) are evicted until it fits, and a model bigger than the cap is not kept at all. Unset, the cache grows until the browser's quota stops it (a failed write keeps nothing, the model still works). The cap is the game's to set: size it by measuring. Load the game's heaviest scenes once with no cap, read ModelCacheControls.usage (e.g. from the console), and set the cap to that with some headroom, so that what one play session needs stays cached. Checked when the cache is made: a value that is not a positive finite number throws (a RangeError). These warn once per cache, with console.warn (each worker keeps its own cache, so a pool of four may warn four times): a cap under CACHE_CAP_FLOOR (16 MiB); a cap above the origin's quota as navigator.storage.estimate() reports it (the browser evicts first, so the cap never applies); and the first entry bigger than the cap, which is then not kept.engine/src/worker/cache.ts:75

On this page