@oomol-lab/resource-cache - v0.1.4
    Preparing search index...

    Interface CacheOptions<T, Q>

    interface CacheOptions<T, Q> {
        decode: (value: unknown) => T;
        key: (query: Q) => string;
        load: (query: Q, validation: CacheValidation) => Promise<LoadResult<T>>;
        maxAge: number;
        namespace: string;
        schemaVersion: number;
    }

    Type Parameters

    • T
    • Q

    Hierarchy (View Summary)

    Index
    decode: (value: unknown) => T

    Restore stored data. Throwing treats that record as a cache miss.

    key: (query: Q) => string

    Stable response identity. Authentication, locale and resource scope belong here only when they change the response. The OOMOL catalog factories are account-independent and define their own identity.

    load: (query: Q, validation: CacheValidation) => Promise<LoadResult<T>>

    Load or conditionally validate a complete response.

    maxAge: number

    Finite nonnegative milliseconds. Zero always requires validation.

    namespace: string

    Nonempty identity for a resource and its data environment.

    schemaVersion: number

    Positive safe integer; increment for incompatible decoding contracts.