public class ClockProPlusEviction extends AbstractEviction
This version uses a static allocation for hot and cold space sizes. No online or dynamic optimization is done yet. However, the hit rate for all measured access traces is better then LRU and it is resistant to scans.
Modifier and Type | Class and Description |
---|---|
static class |
ClockProPlusEviction.Tunable |
correctedMaxSize, heapCache, MAXIMAL_CHUNK_SIZE, maxSize, MINIMAL_CHUNK_SIZE, MINIMUM_CAPACITY_FOR_CHUNKING
Constructor and Description |
---|
ClockProPlusEviction(HeapCache _heapCache,
HeapCacheListener _listener,
long _maxSize) |
Modifier and Type | Method and Description |
---|---|
void |
checkIntegrity(IntegrityState is) |
protected Entry |
findEvictionCandidate(Entry _previous)
Runs cold hand an in turn hot hand to find eviction candidate.
|
String |
getExtraStatistics()
Fragment that the eviction wants to add to the
Cache.toString() output. |
long |
getHitCount()
Number of recorded hits.
|
long |
getSize()
Number of entries in the eviction data structure
|
protected void |
insertIntoReplacementList(Entry e) |
long |
removeAll()
Remove all entries from the eviction data structure.
|
protected void |
removeFromReplacementList(Entry e)
Remove, expire or eviction of an entry happens.
|
void |
removeFromReplacementListOnEvict(Entry e)
Track the entry on the ghost list and call the usual remove procedure.
|
close, drain, evictEventually, evictEventually, getEvictedCount, getEvictionRunningCount, getExpiredRemovedCount, getMaxSize, getMetrics, getNewEntryCount, getRemovedCount, getVirginRemovedCount, runLocked, start, stop, submit, submitWithoutEviction
public ClockProPlusEviction(HeapCache _heapCache, HeapCacheListener _listener, long _maxSize)
public long getHitCount()
EvictionMetrics
public long removeAll()
Eviction
public void removeFromReplacementListOnEvict(Entry e)
removeFromReplacementListOnEvict
in class AbstractEviction
protected void removeFromReplacementList(Entry e)
Why don't generate ghosts here? If the entry is removed because of a programmatic remove or expiry we should not occupy any resources. Removing and expiry may also take place when no eviction is needed at all, which happens when the cache size did not hit the maximum yet. Producing ghosts would add additional overhead, when it is not needed.
removeFromReplacementList
in class AbstractEviction
public long getSize()
EvictionMetrics
protected void insertIntoReplacementList(Entry e)
insertIntoReplacementList
in class AbstractEviction
protected Entry findEvictionCandidate(Entry _previous)
findEvictionCandidate
in class AbstractEviction
public void checkIntegrity(IntegrityState is)
public String getExtraStatistics()
EvictionMetrics
Cache.toString()
output.getExtraStatistics
in interface EvictionMetrics
getExtraStatistics
in class AbstractEviction
cache2k API documentation. Copyright © 2000–2018 headissue GmbH, Munich.