Class CacheManager<T>

A simple cache manager.

Type Parameters

  • T

    The type of the cached objects.

Constructors

Methods

Constructors

Methods

  • Gets the value of the given key from the cache.

    Parameters

    • key: string

      The key to get.

    Returns Promise<undefined | T>

  • Checks if the cache has a value for the given key.

    Parameters

    • key: string

      The key to check.

    Returns Promise<boolean>

  • Sets a key to a value in the cache.

    Parameters

    • key: string

      The key to set.

    • value: T

      The value to set.

    Returns Promise<void>

  • Sets the CacheManager.ttl.

    Parameters

    • OptionalttlMS: number

      If provided, sets the CacheManager.ttl to this value, otherwise uses the default value.

    Returns void