Interface Cache<Records, NonEmpty>

Cache is an object, that can store data records for later use.

Type Parameters

  • Records extends Record<string, Some | null> = Record<string, Some | null>

    The type of the records stored in the cache.

  • NonEmpty extends boolean = false

    Whether the cache is guaranteed to have values for all the keys.

Hierarchy

Methods

  • Clears a value from the cache.

    Type Parameters

    • Key extends string | number | symbol

      The type of the record key.

    Parameters

    • key: Key

      The record key.

    Returns void

  • Checks whether the cache has a value for the specified key.

    Type Parameters

    • Key extends string | number | symbol

      The type of the record key.

    Parameters

    • key: Key

      The record key.

    Returns boolean

    Whether the cache has a value for the specified key.

  • Reads a value from the cache.

    Type Parameters

    • Key extends string | number | symbol

      The type of the record key.

    Parameters

    • key: Key

      The record key.

    Returns NonEmpty extends true
        ? Records[Key]
        : undefined | Records[Key]

    The record value or undefined if the record does not exist.

  • Saves a value to the cache.

    Type Parameters

    • Key extends string | number | symbol

      The type of the record key.

    Parameters

    • key: Key

      The record key.

    • value: Records[Key]

      The record value.

    Returns void

Generated using TypeDoc