Interface KeyValueStorage<TKey, TValue>

A simple storage solution that can be used for internal values that need to be stored.

Type Parameters

  • TKey

  • TValue

Hierarchy

Implemented by

Properties

Properties

delete: ((key) => Promise<boolean>)

Type declaration

    • (key): Promise<boolean>
    • Deletes the value stored for the given key.

      Parameters

      • key: TKey

        Key to delete.

      Returns Promise<boolean>

      If there was a value to delete.

entries: (() => AsyncIterableIterator<[TKey, TValue]>)

Type declaration

    • (): AsyncIterableIterator<[TKey, TValue]>
    • An iterable of entries in the storage.

      Returns AsyncIterableIterator<[TKey, TValue]>

get: ((key) => Promise<undefined | TValue>)

Type declaration

    • (key): Promise<undefined | TValue>
    • Returns the value stored for the given identifier. undefined if no value is stored.

      Parameters

      • key: TKey

      Returns Promise<undefined | TValue>

has: ((key) => Promise<boolean>)

Type declaration

    • (key): Promise<boolean>
    • Checks if there is a value stored for the given key.

      Parameters

      • key: TKey

      Returns Promise<boolean>

set: ((key, value) => Promise<KeyValueStorage<TKey, TValue>>)

Type declaration

    • (key, value): Promise<KeyValueStorage<TKey, TValue>>
    • Sets the value for the given key.

      Parameters

      • key: TKey

        Key to set/update.

      • value: TValue

        Value to store.

      Returns Promise<KeyValueStorage<TKey, TValue>>

      The storage.