@neutrium/utilities - v5.0.0
    Preparing search index...

    Class GenerationalWeakCache<K, V>

    Two generations of weak object keys, with promotion on reads from the older generation. Each generation admits at most generationSize new entries before rotation. Updates to current entries do not consume capacity; deletion and GC do not reclaim admission slots. This is an insertion bound, not a live size or heap-memory guarantee. Values are not copied.

    Type Parameters

    • K extends object
    • V
    Index
    • Read and promote an older entry. Undefined payloads are supported; use has to distinguish misses.

      Parameters

      • key: K

      Returns V | undefined

    • Insert, rotating if needed. Returns false only when retention is disabled. Invalid keys throw.

      Parameters

      • key: K
      • value: V

      Returns boolean