repletes - v1.1.0
    Preparing search index...

    Interface Store<T>

    Where the bytes live. Async everywhere, including in memory, so that moving from a process-local store to a networked one is a constructor change.

    interface Store<T = unknown> {
        clear?(): Promise<void>;
        delete(key: string): Promise<void>;
        get(key: string): Promise<Entry<T> | undefined>;
        set(key: string, entry: Entry<T>, retainFor: number): Promise<void>;
    }

    Type Parameters

    • T = unknown

    Implemented by

    Index
    • Optional, and may be O(n) on a store that has to scan a key prefix.

      Returns Promise<void>

    • Parameters

      • key: string

      Returns Promise<void>

    • Parameters

      • key: string

      Returns Promise<Entry<T> | undefined>

    • retainFor is freshFor + max(swr, sie). Treat it as a hint for reclaiming space; repletes re-checks the windows on the way out and never trusts store expiry for correctness.

      Parameters

      • key: string
      • entry: Entry<T>
      • retainFor: number

      Returns Promise<void>