Options
All
  • Public
  • Public/Protected
  • All
Menu

Class HashGenCacheMap<K, V>

A hashed generational cache map discards the least recently used value with the worst hit rate per hash bucket. HashGenCacheMap is a concurrent and lock-free LRFU cache, with O(1) access time.

Maintaining four "generations" of cached values per hash bucket, the cache discards from the younger generations based on least recent usage, and promotes younger generations to older generations based on most frequent usage. Cache misses count as negative usage of the older generations, biasing the cache against least recently used values with poor hit rates.

Type parameters

  • K

  • V

Hierarchy

  • HashGenCacheMap

Index

Constructors

Methods

Constructors

constructor

Methods

clear

  • clear(): void

get

  • get(key: K): V | undefined

hitRatio

  • hitRatio(): number

put

  • put(key: K, value: V): V

remove

  • remove(key: K): V | undefined