@lzwme/fe-utils
    Preparing search index...

    Class LRUCache<K, V>

    Type Parameters

    • K = string
    • V = unknown
    Index

    Constructors

    Properties

    cache: Map<K, LRUCacheItem<V>> = ...
    options: Required<LRUCacheOptions<K, V>>

    Methods

    • Deletes a key out of the cache

      Parameters

      • key: K
      • reason: DisposeReason = 'delete'

      Returns boolean

    • Return a value from the cache

      Type Parameters

      • T = V

      Parameters

      • key: K
      • options: { updateAgeOnGet?: boolean } = {}

      Returns T | undefined

    • Returns { capacity: number; size: number }

      • capacity: number
      • size: number

        The total number of items held in the cache at the current moment

    • Add a value to the cache

      Type Parameters

      • T = V

      Parameters

      • key: K
      • value: T
      • Optionalopts: { ttl?: number }

      Returns void