Type Parameters

  • T extends NonNullable<unknown>

Implements

Constructors

Properties

debug: Debugger = ...
metadata: CacheManagerMetadata = ...

Methods

  • Returns Promise<boolean>

  • Clear all keys that match a prefix

    Parameters

    • prefix: string

      The prefix to filter keys by

    Returns Promise<[boolean, boolean[]]>

    Whether the cache was cleared, and an array of booleans for each key

  • Parameters

    • key: string

    Returns Promise<boolean>

  • Returns Promise<undefined>

  • Parameters

    • key: string

    Returns Promise<undefined | null | T>

  • Parameters

    • key: string

      The key to check for

    Returns boolean

    Whether the key exists in the cache

  • Check if the item is data (not null or undefined)

    Parameters

    • item: undefined | null | T

      The item to check

    • allowNull: false

      Whether to allow null values

    Returns item is T

    Whether the item is valid (cache) data

  • Returns string[]

    An array of all keys stored in the cache

  • Get all (cached) keys that match a prefix

    Parameters

    • prefix: string

      The prefix to filter keys by

    Returns string[]

    An array of keys that match the prefix

  • Parameters

    • keys: string[]

    Returns Promise<[boolean, boolean[]]>

  • Parameters

    • keys: string[]

    Returns Promise<(undefined | null | T)[]>

  • Type Parameters

    • E extends keyof Events

    Parameters

    • event: E
    • listener: Events[E]

    Returns EventEmitter

  • Type Parameters

    • E extends keyof Events

    Parameters

    • event: E
    • listener: Events[E]

    Returns EventEmitter

  • Parameters

    • key: string
    • value: null | T
    • Optionalttl: number

    Returns Promise<null | T>

  • Parameters

    • key: string

    Returns Promise<null | number>

  • Parameters

    • key: string
    • fnc: () => T | Promise<T>
    • Optionalttl: number | (value: T) => number
    • OptionalrefreshThreshold: number

    Returns Promise<T>

  • Create a new cache manager from a store (Keyv or LRUCache)

    Type Parameters

    • O extends {}

    Parameters

    Returns CacheManager<O>

    A new cache manager

  • Hash any data type into a string, for use as a cache key

    Parameters

    • value: {}

      The value to hash

    Returns string

    The hashed value as a string