The type of items that the cache will store.
Creates an instance of the DecayCache class with a specified capacity and half-life.
The maximum number of items the cache can hold.
Optional halfLife: number = 300000The time (in milliseconds) after which the score of a cache item is halved.
Private halfProtected headProtected tailProtected attachPrivate calculateProtected getProtected hitProtected insertProtected method that insert a cache item just after another item in the linked list.
The item which already is in the list. The new item will be inserted at the position right after this item.
The item that will be inserted into the list.
Adds an item to the cache or updates an existing item's value. If the cache reaches its capacity, it evicts an item based on the specific cache's eviction policy.
The key associated with the item.
The value to be stored in the cache.
Optional expiry: numberOptional expiry time for the item.
Protected removeGenerated using TypeDoc
DecayCache class that extends BasicCache to implement a decay-based cache eviction policy. Cache items have a score which decays over time. The score increases with each access, and the item's position in the cache is adjusted based on its score relative to other items.