@adviser/cement - v0.0.0
    Preparing search index...

    Class LRUSet<T>

    A Set implementation with Least Recently Used (LRU) eviction policy.

    LRUSet maintains a set of values with automatic eviction of least recently accessed items when capacity limits are reached. Items are moved to the end of the access order when accessed.

    const cache = new LRUSet<string>({ maxEntries: 3 });
    cache.add('a');
    cache.add('b');
    cache.add('c');
    cache.add('d'); // 'a' is evicted
    console.log(cache.has('a')); // false

    Type Parameters

    • T

      The type of values in the set

    Index

    Constructors

    Accessors

    Methods

    Constructors

    Accessors

    Methods

    • Parameters

      • callbackfn: (value: T, key: T) => void

      Returns void