an implementation of Map that stores values for a maximum duration in milliseconds before they expire. can optionally store either in memory (default) or on the filesystem (using a FileSystemMap) so other instances in other running node processes can use the same cache data.

Param

the amount of time in milliseconds that stored values remain valid

Param

if true values will be stored on the filesystem which can be shared between multiple running node processes (sharded parallel testing for example); otherwise values are stored in memory only

Param

the name of the file to pass to the FileSystemMap used to store values on the filesystem if useFileCache is true

Type Parameters

Hierarchy

  • CacheMap

Implements

  • Map<K, V>

Constructors

Properties

INFINITY: -1 = -1
_cacheDuration: number
_internalMap: Map<K, CacheObject> | FileSystemMap<K, CacheObject>

Accessors

Methods

  • gets the CacheContainer for a given key if it exists and returns the number of milliseconds since the epoch representing the when the value will no longer be valid (cache expired). If not found a value of 0 is returned

    Parameters

    • key: K

      the map key

    Returns number

  • Parameters

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

          • value: V
          • key: K
          • map: Map<K, V>

          Returns void

    • Optional thisArg: any

    Returns void

Generated using TypeDoc