@triply/triplydb
    Preparing search index...

    Type Alias Cache

    Somewhere to store query responses between runs.

    Pass one to Query.results to avoid re-running a query whose results you already have. Implement it yourself, or use fileCache for a cache backed by a directory on disk.

    type Cache = {
        cacheId: string | undefined;
        read: FromCacheFn;
        write: ToCacheFn;
    }
    Index
    cacheId: string | undefined

    Namespace for the entries this cache holds.

    Set by whatever is being cached rather than by you — Query.results fills in the query's id, so two queries sharing one cache do not read each other's entries.

    Returns a stored response, or nothing when this request has not been cached.

    write: ToCacheFn

    Stores one response. Called after a request the cache did not answer.