Type Parameters

  • T

Hierarchy (view full)

Implements

Constructors

Properties

[toStringTag]: string
cacheAdds: number = 0
cacheCapacityExceeded: number = 0
cacheClears: number = 0
cacheDeletes: number = 0
cacheExpirations: number = 0
cacheHits: number = 0
cacheMisses: number = 0
cacheUpdates: number = 0
capacity: null | number

Maximum number of items to store in this cache

expireIds: Map<string, Timeout> = ...

Map of TimeoutIds for each key - used to track TTL

onCapacityExceeded?: ((key) => void | Promise<void>)

Callback to run when cache capacity is exceeded

Type declaration

    • (key): void | Promise<void>
    • Parameters

      • key: string

      Returns void | Promise<void>

onClear?: ((itemCount) => void | Promise<void>)

Callback to run when cache is cleared

Type declaration

    • (itemCount): void | Promise<void>
    • Parameters

      • itemCount: number

      Returns void | Promise<void>

onKeyAdd?: ((key) => void | Promise<void>)

Callback to run when a key is added

Type declaration

    • (key): void | Promise<void>
    • Parameters

      • key: string

      Returns void | Promise<void>

onKeyDelete?: ((key, reason?) => void | Promise<void>)

Callback to run when a key is deleted

Type declaration

    • (key, reason?): void | Promise<void>
    • Parameters

      • key: string
      • Optional reason: string

      Returns void | Promise<void>

onKeyExpire?: ((key) => void | Promise<void>)

Callback to run when a key expires

Type declaration

    • (key): void | Promise<void>
    • Parameters

      • key: string

      Returns void | Promise<void>

onKeyUpdate?: ((key) => void | Promise<void>)

Callback to run when a key is updated

Type declaration

    • (key): void | Promise<void>
    • Parameters

      • key: string

      Returns void | Promise<void>

size: number

Returns

the number of elements in the Map.

ttl: number

Time to live for data added to this cache

[species]: MapConstructor

Methods

  • Returns an iterable of entries in the map.

    Returns IterableIterator<[string, T]>

  • Returns an iterable of key, value pairs for every entry in the map.

    Returns IterableIterator<[string, T]>

  • Executes a provided function once per each key/value pair in the Map, in insertion order.

    Parameters

    • callbackfn: ((value, key, map) => void)
        • (value, key, map): void
        • Parameters

          • value: T
          • key: string
          • map: Map<string, T>

          Returns void

    • Optional thisArg: any

    Returns void

  • Parameters

    • key: string

    Returns boolean

    boolean indicating whether an element with the specified key exists or not.

  • Returns an iterable of keys in the map

    Returns IterableIterator<string>

  • Returns an iterable of values in the map

    Returns IterableIterator<T>