Class QuickLRU<KeyType, ValueType>

Type Parameters

  • KeyType
  • ValueType
Implements
Hierarchy

Constructors

Accessors

  • get maxSize(): number
  • The set max size.

    Returns number

  • get size(): number
  • The stored item count.

    Returns number

Methods

  • Delete all items.

    Returns void

  • Delete an item.

    Parameters

    Returns boolean

    true if the item is removed or false if the item doesn't exist.

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

    Parameters

    Returns void

  • Check if an item exists.

    Parameters

    Returns boolean

  • Get an item without marking it as recently used.

    Parameters

    Returns ValueType

    The stored item or undefined.

  • Update the maxSize in-place, discarding items as necessary. Insertion order is mostly preserved, though this is not a strong guarantee.

    Useful for on-the-fly tuning of cache sizes in live systems.

    Parameters

    • maxSize: number

    Returns void

  • Set an item. Returns the instance.

    Individual expiration of an item can be specified with the maxAge option. If not specified, the global maxAge value will be used in case it is specified in the constructor, otherwise the item will never expire.

    Parameters

    • key: KeyType
    • value: ValueType
    • Optionaloptions: {
          maxAge?: number;
      }
      • OptionalmaxAge?: number

    Returns this

    The list instance.

Properties

[toStringTag]: string
[species]: MapConstructor