Options
All
  • Public
  • Public/Protected
  • All
Menu

A KeyValueStorage in which the values can expire. Entries with no expiration date never expire.

Type parameters

  • TKey

  • TValue

Hierarchy

Implemented by

Index

Properties

Properties

delete

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

Deletes the value stored for the given key.

Type declaration

    • (key: TKey): 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

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

An iterable of entries in the storage.

Type declaration

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

      Returns AsyncIterableIterator<[TKey, TValue]>

get

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

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

Type declaration

    • (key: TKey): 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

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

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

Type declaration

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

      Parameters

      • key: TKey

      Returns Promise<boolean>

set

set: (key: TKey, value: TValue, expires?: Date) => Promise<ExpiringStorage<TKey, TValue>>

Sets the value for the given key.

Type declaration

    • (key: TKey, value: TValue, expires?: Date): Promise<ExpiringStorage<TKey, TValue>>
    • Sets the value for the given key. Should error if the data is already expired.

      Parameters

      • key: TKey

        Key to set/update.

      • value: TValue

        Value to store.

      • Optional expires: Date

        When this value expires. Never if undefined.

      Returns Promise<ExpiringStorage<TKey, TValue>>

      The storage.