public abstract class AbstractEviction extends Object implements Eviction, EvictionMetrics
| Modifier and Type | Field and Description |
|---|---|
protected long |
correctedMaxSize |
protected HeapCache |
heapCache |
static int |
MAXIMAL_CHUNK_SIZE |
protected long |
maxSize |
static int |
MINIMAL_CHUNK_SIZE |
static long |
MINIMUM_CAPACITY_FOR_CHUNKING |
| Constructor and Description |
|---|
AbstractEviction(HeapCache _heapCache,
HeapCacheListener _listener,
long _maxSize) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Free resources, for example thread pool or queue.
|
boolean |
drain()
Drain eviction queue and do updates in the eviction data structures.
|
void |
evictEventually()
Evict if needed, checks all segments.
|
void |
evictEventually(int hc)
Evict if needed, focused on the segment addressed by the hash code.
|
protected abstract Entry |
findEvictionCandidate(Entry e)
Find a candidate for eviction.
|
long |
getEvictedCount()
Number of entries evicted
|
int |
getEvictionRunningCount()
Number of eviction currently going on
|
long |
getExpiredRemovedCount()
Removed entries, because expired
|
String |
getExtraStatistics()
Fragment that the eviction wants to add to the
Cache.toString() output. |
long |
getMaxSize()
Size limit after eviction kicks in
|
EvictionMetrics |
getMetrics() |
long |
getNewEntryCount() |
long |
getRemovedCount() |
long |
getVirginRemovedCount()
Removal of an entry that was never used
|
protected abstract void |
insertIntoReplacementList(Entry e) |
protected abstract void |
removeFromReplacementList(Entry e) |
protected void |
removeFromReplacementListOnEvict(Entry e) |
<T> T |
runLocked(Job<T> j)
Runs job making sure concurrent evictions operations pause.
|
void |
start()
Start concurrent eviction threads.
|
void |
stop()
Stop concurrent threads that may access the eviction data structures.
|
boolean |
submitWithoutEviction(Entry e)
Submit to eviction for inserting or removing from the replacement list.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcheckIntegrity, removeAllgetHitCount, getSizepublic static final int MINIMAL_CHUNK_SIZE
public static final int MAXIMAL_CHUNK_SIZE
public static final long MINIMUM_CAPACITY_FOR_CHUNKING
protected final long maxSize
protected final long correctedMaxSize
protected final HeapCache heapCache
public AbstractEviction(HeapCache _heapCache, HeapCacheListener _listener, long _maxSize)
public boolean submitWithoutEviction(Entry e)
EvictionsubmitWithoutEviction in interface Evictionpublic void evictEventually()
EvictionevictEventually in interface Evictionpublic void evictEventually(int hc)
EvictionevictEventually in interface Evictionpublic long getNewEntryCount()
getNewEntryCount in interface EvictionMetricsInternalCacheInfo.getNewEntryCount()public long getRemovedCount()
getRemovedCount in interface EvictionMetricsInternalCacheInfo.getRemoveCount()public long getVirginRemovedCount()
EvictionMetricsgetVirginRemovedCount in interface EvictionMetricspublic long getExpiredRemovedCount()
EvictionMetricsgetExpiredRemovedCount in interface EvictionMetricsInternalCacheInfo.getExpiredCount()public long getEvictedCount()
EvictionMetricsgetEvictedCount in interface EvictionMetricsInternalCacheInfo.getEvictedCount()public long getMaxSize()
EvictionMetricsgetMaxSize in interface EvictionMetricspublic int getEvictionRunningCount()
EvictionMetricsgetEvictionRunningCount in interface EvictionMetricspublic EvictionMetrics getMetrics()
getMetrics in interface Evictionpublic void start()
Evictionpublic void stop()
Evictionpublic boolean drain()
Evictionpublic void close()
Evictionpublic <T> T runLocked(Job<T> j)
Evictionprotected void removeFromReplacementListOnEvict(Entry e)
protected abstract Entry findEvictionCandidate(Entry e)
e - null or previous found eviction candidate returned by this method.
This is currently not used by the implemented eviction methods
but might be in the future.protected abstract void removeFromReplacementList(Entry e)
protected abstract void insertIntoReplacementList(Entry e)
public String getExtraStatistics()
EvictionMetricsCache.toString() output.getExtraStatistics in interface EvictionMetricscache2k API documentation. Copyright © 2000–2019 headissue GmbH, Munich.