Options
All
  • Public
  • Public/Protected
  • All
Menu

Implementation for an in-memory data structure with support for limiting of values in the cache

Type parameters

  • V = unknown

    value type

  • K = string

    key type (string by default)

Hierarchy

Index

Constructors

  • new default<V, K>(max?: number): default<V, K>

Properties

capacity: number = 20

Number of maximum records in the cache

queue: Set<K> = ...

Queue object

storage: Map<K, V> = ...

Cache object

Accessors

  • get size(): number

Methods

  • [iterator](): IterableIterator<K>
  • entries(): IterableIterator<[K, V]>
  • has(key: K): boolean
  • keys(): IterableIterator<K>
  • set(key: K, value: V): V
  • setCapacity(value: number): Map<K, V>
  • Sets a new capacity of the cache. The method returns a map of truncated elements that the cache can't fit anymore.

    Parameters

    • value: number

    Returns Map<K, V>

  • values(): IterableIterator<V>