Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface KeyValueStorage<TKey, TValue>

A simple storage solution that can be used for internal values that need to be stored. In general storages taking objects as keys are expected to work with different instances of an object with the same values. Exceptions to this expectation should be clearly documented.

Type parameters

  • TKey

  • TValue

Hierarchy

  • KeyValueStorage

Index

Properties

Properties

delete

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

Deletes the value stored for the given key.

param

Key to delete.

returns

If there was a value to delete.

Type declaration

    • (key: TKey): Promise<boolean>
    • Parameters

      • key: TKey

      Returns Promise<boolean>

entries

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

An iterable of entries in the storage.

Type declaration

    • (): AsyncIterableIterator<[TKey, TValue]>
    • Returns AsyncIterableIterator<[TKey, TValue]>

get

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

Returns the value stored for the given identifier. undefined if no value is stored.

param

Identifier to get the value for.

Type declaration

    • (key: TKey): Promise<TValue | undefined>
    • Parameters

      • key: TKey

      Returns Promise<TValue | undefined>

has

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

Checks if there is a value stored for the given key.

param

Identifier to check.

Type declaration

    • (key: TKey): Promise<boolean>
    • Parameters

      • key: TKey

      Returns Promise<boolean>

set

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

Sets the value for the given key.

param

Key to set/update.

param

Value to store.

returns

The storage.

Type declaration

    • (key: TKey, value: TValue): Promise<this>
    • Parameters

      • key: TKey
      • value: TValue

      Returns Promise<this>