@freedomofpress/webcat
    Preparing search index...

    Class LRUCache<K, V>

    A fixed-size in-memory cache that automatically evicts the least recently used entry first when it reaches its size limit.

    Type Parameters

    • K

      The type of cache keys.

    • V

      The type of values store in this cache.

    Hierarchy (View Summary)

    Index
    • Type Parameters

      • K

        The type of cache keys.

      • V

        The type of values store in this cache.

      Parameters

      • limit: number

        The maximum number of entries held by the cache.

      Returns LRUCache<K, V>

    • Clears all values from the cache.

      Returns Promise<void>

    • Clears a single value from the cache.

      Parameters

      • key: K

        The key to clear.

      Returns Promise<void>

    • Reads a cached value.

      Parameters

      • key: K

        The key to read.

      Returns Promise<V | undefined>

      A Promise that resolves with the value read.

    • Parameters

      • key: K

      Returns Promise<boolean>

      A Promise that resolves to true if the given key exists in the cache.

    • Returns Promise<K[]>

      A Promise that resolves to an array of the keys in the cache.

    • Caches a value.

      Parameters

      • key: K

        The key to use.

      • value: V

        The value to cache.

      Returns Promise<void>