Class TinyLfu
- java.lang.Object
-
- com.github.benmanes.caffeine.cache.simulator.admission.TinyLfu
-
- All Implemented Interfaces:
Admittor,Admittor.KeyOnlyAdmittor
public final class TinyLfu extends Object implements Admittor.KeyOnlyAdmittor
Admits new entries based on the estimated frequency of its historic use.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.github.benmanes.caffeine.cache.simulator.admission.Admittor
Admittor.KeyOnlyAdmittor
-
-
Constructor Summary
Constructors Constructor Description TinyLfu(Config config, PolicyStats policyStats)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadmit(long candidateKey, long victimKey)Returns if the candidate should be added to the cache and the page replacement policy's chosen victim should be removed.intfrequency(long key)voidrecord(long key)Records the access to the entry.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.github.benmanes.caffeine.cache.simulator.admission.Admittor.KeyOnlyAdmittor
admit, record
-
-
-
-
Constructor Detail
-
TinyLfu
public TinyLfu(Config config, PolicyStats policyStats)
-
-
Method Detail
-
frequency
public int frequency(long key)
-
record
public void record(long key)
Description copied from interface:AdmittorRecords the access to the entry.- Specified by:
recordin interfaceAdmittor- Specified by:
recordin interfaceAdmittor.KeyOnlyAdmittor
-
admit
public boolean admit(long candidateKey, long victimKey)Description copied from interface:AdmittorReturns if the candidate should be added to the cache and the page replacement policy's chosen victim should be removed.- Specified by:
admitin interfaceAdmittor- Specified by:
admitin interfaceAdmittor.KeyOnlyAdmittor- Parameters:
candidateKey- the key to the newly added entryvictimKey- the key to the entry the policy recommends removing- Returns:
- if the candidate should be added and the victim removed due to eviction
-
-