UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

67 lines 2.06 kB
/** * UNTESTED, DO NOT USE. * Use {@link Cache} or {@link LoadingCache} instead * @template K,V */ export class CacheV2<K, V> { /** * * @type {Deque<Node<K,V>>} * @private */ private __accessOrderWindowDeque; /** * * @type {Deque<Node<K,V>>} * @private */ private __accessOrderProbationDeque; __windowWeightedSize: number; __window_maximum: number; __maximum_weight: number; /** * @returns {number} * @protected */ protected weightedSize(): number; /** * @returns {FrequencySketch} * @protected */ protected frequencySketch(): FrequencySketch; setMaximum(value: any): void; setWindowMaximum(value: any): void; setMainProtectedMaximum(value: any): void; /** * * @param value */ setStepSize(value: any): void; setHitsInSample(value: any): void; setMissesInSample(value: any): void; /** * Sets the maximum weighted size of the cache. The caller may need to perform a maintenance cycle * to eagerly evicts entries until the cache shrinks to the appropriate size. * @param {number} maximum */ setMaximumSize(maximum: number): void; /** * Evicts entries if the cache exceeds the maximum. * @private */ private evictEntries; /** * Determines if the candidate should be accepted into the main space, as determined by its * frequency relative to the victim. A small amount of randomness is used to protect against hash * collision attacks, where the victim's frequency is artificially raised so that no new entries * are admitted. * * @param {number} candidate_hash the key for the entry being proposed for long term retention * @param {number} victim_hash the key for the entry chosen by the eviction policy for replacement * @returns {boolean} */ admit(candidate_hash: number, victim_hash: number): boolean; evictFromWindow(): number; evictFromMain(): void; } //# sourceMappingURL=CacheV2.d.ts.map