Class LruCache<T, U>

A least-recently-used cache.

Type Parameters

  • T
  • U

Constructors

Properties

Accessors

Methods

Constructors

Properties

_map: Map<T, U> = ...
_maxSize: number

Accessors

  • get size(): number
  • Return the current size of the cache.

    Returns number

Methods

  • Clear the values in the cache.

    Returns void

  • Get a value (or null) from the cache, pushing the item to the front of the cache.

    Parameters

    • key: T

    Returns null | U

  • Set a value in the cache, potentially evicting an old item.

    Parameters

    • key: T
    • value: U

    Returns void