UNPKG

@thermopylae/lib.cache

Version:
32 lines (31 loc) 1.3 kB
import { Threshold } from '@thermopylae/core.declarations'; import { BaseLFUEvictionPolicy, EvictableCacheEntry } from './lfu-base'; import { CacheBackendElementsCount } from '../../contracts/cache-backend'; /** * [Least Frequently Used with Dynamic Aging](https://en.wikipedia.org/wiki/Cache_replacement_policies#LFU_with_dynamic_aging_(LFUDA) "LFU with dynamic aging (LFUDA)") eviction policy. * * @template Key Type of the key. * @template Value Type of the value. * @template ArgumentsBundle Type of the arguments bundle. */ declare class LFUDAEvictionPolicy<Key, Value, ArgumentsBundle> extends BaseLFUEvictionPolicy<Key, Value, ArgumentsBundle> { private cacheAge; /** * @param cacheMaxCapacity {@link Cache} maximum capacity. * @param cacheBackendElementsCount Cache backend elements count. */ constructor(cacheMaxCapacity: Threshold, cacheBackendElementsCount: CacheBackendElementsCount); /** * @inheritDoc */ protected get initialFrequency(): number; /** * @inheritDoc */ protected computeEntryFrequency(_entry: EvictableCacheEntry<Key, Value>, entryScore: number): number; /** * @inheritDoc */ protected onEvict(frequencyOfTheEvictedEntry: number): void; } export { LFUDAEvictionPolicy };