Implementation of caching that uses session storage

Implements

Constructors

Properties

Methods

Constructors

Properties

prefix: string = CACHE_KEY_PREFIX

Methods

  • It returns an array of all the keys in the session storage that start with the prefix

    Returns string[]

    An array of all the keys in the sessionStorage that start with the prefix.

  • It gets the value of the key from the session storage, parses it as JSON, and returns it

    Type Parameters

    Parameters

    • key: string

      The key to store the data under.

    Returns undefined | T

    The value of the key in the sessionStorage.

  • It takes a key and an entry, and sets the entry in the session storage with the key

    Type Parameters

    Parameters

    • key: string

      The key to store the entry under.

    • entry: T

      The value to be stored in the cache.

    Returns void