Class LRUCache<TKey, TValue>

A simple LRU cache implementation. LRU cache is a cache that evicts the least recently used item when it is full.

Type Parameters

  • TKey

  • TValue

Hierarchy

  • LRUCache

Constructors

Properties

Methods

Constructors

Properties

cache: Map<TKey, TValue>
capacity: number

Methods

  • Returns IterableIterator<[TKey, TValue]>

  • Get a value from the cache.

    Parameters

    • key: TKey

    Returns TValue

  • Set a value in the cache.

    Parameters

    • key: TKey
    • value: TValue

    Returns void

Generated using TypeDoc