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

    Class BudgetCache<V>

    String-keyed LRU with estimated byte accounting, not a heap-memory guarantee. Cost = entry overhead + two bytes per UTF-16 key code unit + measured payload. Values remain caller-owned unless detach is supplied; do not mutate retained values in a way that changes their measured size. Callbacks are synchronous.

    Type Parameters

    • V
    Index
    • get weight(): number

      Total estimated retained bytes, including keys and entry overhead.

      Returns number

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

      Parameters

      • key: string

      Returns boolean

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

      Parameters

      • key: string

      Returns V | undefined

    • Test membership without refreshing recency.

      Parameters

      • key: string

      Returns boolean

    • Iterate keys from least to most recently used without refreshing recency.

      Returns IterableIterator<string>

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

      Parameters

      • key: string

      Returns V | undefined

    • Chainable insertion; use trySet to observe admission or rejection.

      Parameters

      • key: string
      • value: V

      Returns this

    • Rejection or callback failure does not replace, evict, or refresh existing entries.

      Parameters

      • key: string
      • value: V

      Returns boolean