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) |
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.
|
void |
submit(Entry e)
Submit to eviction for inserting or removing from the replacement list.
|
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, wait
checkIntegrity, removeAll
getHitCount, getSize
public 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 void submit(Entry e)
Eviction
Whether the entry is inserted or removed is detected via the entry
state Entry.isNotYetInsertedInReplacementList()
.
public boolean submitWithoutEviction(Entry e)
Eviction
submitWithoutEviction
in interface Eviction
public void evictEventually()
Eviction
evictEventually
in interface Eviction
public void evictEventually(int hc)
Eviction
evictEventually
in interface Eviction
public long getNewEntryCount()
getNewEntryCount
in interface EvictionMetrics
InternalCacheInfo.getNewEntryCount()
public long getRemovedCount()
getRemovedCount
in interface EvictionMetrics
InternalCacheInfo.getRemoveCount()
public long getVirginRemovedCount()
EvictionMetrics
getVirginRemovedCount
in interface EvictionMetrics
public long getExpiredRemovedCount()
EvictionMetrics
getExpiredRemovedCount
in interface EvictionMetrics
InternalCacheInfo.getExpiredCount()
public long getEvictedCount()
EvictionMetrics
getEvictedCount
in interface EvictionMetrics
InternalCacheInfo.getEvictedCount()
public long getMaxSize()
EvictionMetrics
getMaxSize
in interface EvictionMetrics
public int getEvictionRunningCount()
EvictionMetrics
getEvictionRunningCount
in interface EvictionMetrics
public EvictionMetrics getMetrics()
getMetrics
in interface Eviction
public void start()
Eviction
public void stop()
Eviction
public boolean drain()
Eviction
public void close()
Eviction
public <T> T runLocked(Job<T> j)
Eviction
protected void removeFromReplacementListOnEvict(Entry e)
protected abstract void removeFromReplacementList(Entry e)
protected abstract void insertIntoReplacementList(Entry e)
public String getExtraStatistics()
EvictionMetrics
Cache.toString()
output.getExtraStatistics
in interface EvictionMetrics
cache2k API documentation. Copyright © 2000–2018 headissue GmbH, Munich.