Luxar Viewer API Documentation - v2026.10.19
    Preparing search index...

    L0 Decompressed Chunk Cache.

    Uses LRU eviction with byte-size tracking to cache decompressed zarr chunks. Key format: ${arrayPath}:${chunkCoords.join(',')} (e.g., "/points/positions:0,1,2")

    const cache = new DecompressedChunkCache({ maxSize: 200 * 1024 * 1024 });

    // Cache a decompressed chunk
    const key = DecompressedChunkCache.makeKey('/points/positions', [0, 1, 2]);
    cache.set(key, { data: float32Array, shape: [1000, 3], stride: [3, 1] });

    // Retrieve cached chunk
    const cached = cache.get(key);
    if (cached) {
    console.log('L0 hit!', cached.data.byteLength, 'bytes');
    }
    Index
    METADATA_OVERHEAD: 64

    Metadata overhead estimate per chunk (shape array, stride array, object wrapper)

    inflight: Map<string, InflightDecode> = ...

    In-flight decodes keyed by the full L0 key (makeKey(arrayPath, coords), so the array identity is part of the key). Lives on the CACHE — not on a proxy — so the foreground loaders and the SlicePrefetcher's shadow loaders, which wrap the same arrays through different proxies, share one decode.

    _generation: number = 0

    Bumped by every clear(); see generation.

    debug: boolean
    maxSize: number

    Resolved byte budget — surfaced in getStats() for runtime introspection.

    • get generation(): number

      Incremented by every clear (the invalidation / dispose path). Holders of state derived from this cache's contents — e.g. the range loader's memoised, L0-wrapped array_ref targets — compare it to know when to re-derive.

      Returns number

    • Default cache size derived from config.cache.l0MaxSizeMB. A method, not a static initializer, like SliceCache.defaultMaxSize: reading config at module-load time couples every transitive importer to a fully-populated config mock in tests.

      Returns number

    • Get a cached decompressed chunk.

      Parameters

      • key: string

        Cache key (use makeKey() to generate)

      • Optionaloptions: { countStats?: boolean }
        • OptionalcountStats?: boolean

          false for a warm-up: the lookup promotes the chunk but moves no hit/miss statistic (see getStats).

      Returns DecompressedChunk | undefined

      Cached chunk or undefined if not found

    • Clear all cached chunks. Also forgets the in-flight decodes: a decode started before the clear still settles for its waiters, but no longer commits its result (only a still-registered entry may set), and a new request starts afresh rather than joining pre-clear work.

      Returns void

    • Generate a cache key from array path and chunk coordinates.

      Parameters

      • arrayPath: string

        Full path to the zarr array (e.g., "/points/positions")

      • chunkCoords: number[]

        Chunk coordinates (e.g., [0, 1, 2])

      Returns string

      Cache key string

      const key = DecompressedChunkCache.makeKey('/scene/points/positions', [0, 1, 2]);
      // Returns: "/scene/points/positions:0,1,2"