Class LruCache<T, U>

A least-recently-used cache.

Type Parameters

  • T

  • U

Hierarchy

  • LruCache

Constructors

Properties

Accessors

Methods

Constructors

  • Type Parameters

    • T

    • U

    Parameters

    Returns LruCache<T, U>

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 U

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

    Parameters

    • key: T
    • value: U

    Returns void

Generated using TypeDoc