@neutrium/utilities - v3.1.0
    Preparing search index...

    Class LruCache<K, V>

    Synchronous, bounded cache using Map key identity (SameValueZero). Successful get/set refresh recency; has/peek/keys do not. Values are not copied. Rejected or throwing insertions leave the cache unchanged. Callbacks must not mutate this cache. No TTL, background work, or asynchronous loading is performed.

    Type Parameters

    • K
    • V

    Hierarchy (View Summary)

    Index
    • get size(): number

      Number of currently retained entries.

      Returns number

    • get weight(): number

      Sum of currently retained entry weights.

      Returns number

    • Remove all entries and reset retained weight to zero.

      Returns void

    • Remove an entry and its weight; return whether it existed.

      Parameters

      • key: K

      Returns boolean

    • Read a value and mark an existing entry most recently used.

      Parameters

      • key: K

      Returns V | undefined

    • Test membership without refreshing recency.

      Parameters

      • key: K

      Returns boolean

    • Live iterator, ordered least to most recently used.

      Returns MapIterator<K>

    • Read a value without refreshing recency; missing keys return undefined.

      Parameters

      • key: K

      Returns V | undefined

    • Chainable insertion. Use trySet when admission needs to be observed.

      Parameters

      • key: K
      • value: V

      Returns this

    • False means disabled or oversized. An existing value is preserved on rejection.

      Parameters

      • key: K
      • value: V

      Returns boolean