Cache class.

Type Parameters

  • T

Hierarchy

  • Cache

Constructors

Properties

Accessors

Methods

Constructors

  • Type Parameters

    • T

    Returns Cache<T>

Properties

_cache: Record<string, T> = {}
_queue: string[] = []
max: number = 100

Maximum number of values in cache, defaults to 100.

Accessors

  • get size(): number
  • Current size of the cache.

    Returns number

Methods

  • Get cached value.

    Parameters

    • key: string

    Returns undefined | T

  • Add value to the cache.

    Parameters

    • key: string
    • value: T

    Returns void

Generated using TypeDoc