fgb-vt - v1.0.6
    Preparing search index...

    Class MemoryCache

    In-memory ByteCache with least-recently-used eviction, bounded by the total size of its values.

    import { TileClient, S3Connector, MemoryCache } from '@geozelot/fgb-vt';

    // Module scope: survives warm invocations of a serverless function
    const cache = new MemoryCache({ maxBytes: 128 * 1024 * 1024 });
    const client = new TileClient(new S3Connector({ region: 'us-east-1' }), { cache });

    Implements

    Index
    • get bytes(): number

      Total size of cached values in bytes.

      Returns number

    • get size(): number

      Number of cached entries.

      Returns number

    • Remove all entries.

      Returns void

    • Remove key if present.

      Parameters

      • key: string

        Cache key.

      Returns void

    • Look up key, marking it most recently used.

      Parameters

      • key: string

        Cache key.

      Returns Uint8Array<ArrayBufferLike> | undefined

      The cached bytes, or undefined.

    • Store value under key, evicting least-recently-used entries as needed. Values larger than the whole cache are not stored.

      Parameters

      • key: string

        Cache key.

      • value: Uint8Array

        Bytes to store (not copied; must not be mutated afterwards).

      Returns void