@freedomofpress/webcat
    Preparing search index...

    Class NamespacedKVStore

    Namespaced key-value storage. Operations are atomic within an instance; distinct instances of the same namespace may access the same data in an unsafe manner.

    Hierarchy (View Summary)

    Implements

    Index
    • Clears all values whose key matches the specified prefix.

      Parameters

      • prefix: string = ""

        The prefix to match against.

      • area: "local" | "session" = "local"

        The name of the storage area to use.

      Returns Promise<void>

    • Reads a persisted value.

      Parameters

      • key: string

        The key to read.

      • area: "local" | "session" = "local"

        The name of the storage area to read from.

      Returns Promise<any>

      A Promise that resolves to the value read.

    • Retrieves a list of stored keys matching the specified prefix.

      Parameters

      • prefix: string = ""

        The prefix to match against.

      • area: "local" | "session" = "local"

        The name of the storage area to read from.

      Returns Promise<string[]>

      A Promise that resolves to an array of matching keys.

    • Clears a single persisted value.

      Parameters

      • key: string

        The key to clear.

      • Optionalarea: "local" | "session"

        The name of the storage area to use.

      Returns Promise<void>

    • Stores values.

      Parameters

      • items: { [key: string]: unknown }

        An object consisting of one or more key/value pairs to store.

      • area: "local" | "session" = "local"

        The name of the storage area to use.

      Returns Promise<void>