A basic TTL cache with configurable TTL and check interval.

Hierarchy

  • TtlCache

Constructors

Properties

_checkIntervalHandle: any
_options: any
_purgeStale: any
_storage: any

Methods

  • Clear the items that are in the cache.

    Returns void

  • Indicate that you are no longer going to use the cache. The cache will be cleared and it will stop checking for stale items.

    Returns void

  • Delete the item with the specific key. If the item does not exist, then there will be no change to the cache.

    Parameters

    • key: string

      The key of the value to delete.

    Returns void

  • Get a value from the cache.

    Parameters

    • key: string

      The key to get a value for.

    Returns any

    The value for the key, or undefined if the key was not added, or if the value has expired.

  • Set an item in the cache. It will expire after the TTL specified in the cache configuration.

    Parameters

    • key: string

      The key for the value.

    • value: any

      The value to set.

    Returns void

Generated using TypeDoc