public class CacheLimit<K,V> extends Cache<K,V>
Cache.CleanupThread| Modifier and Type | Field and Description |
|---|---|
protected EvictionInterface<K,V> |
evictionClass |
protected AtomicLong |
evictionCount |
| Constructor and Description |
|---|
CacheLimit(TCacheFactory factory,
Builder<K,V> builder) |
| Modifier and Type | Method and Description |
|---|---|
protected String |
configToString() |
protected int |
elementsToRemove()
Determine how many elements to remove.
|
protected boolean |
ensureFreeCapacity()
Frees entries, if the Cache is near full.
|
protected String |
evictionConfigInfo() |
protected int |
evictionExtraSpace(Builder<K,V> builder)
Calculates the amount of extra space that we need as eviction extra space in the storage Map.
|
protected TCacheStatisticsInterface |
fillCacheStatistics(TCacheStatisticsInterface cacheStatistic)
Fills the given cache statistics object.
|
protected boolean |
isFull()
Returns whether the Cache is full.
|
protected boolean |
isOverfull()
Returns whether the cache is overfull.
|
void |
shutdownCustomImpl()
Shuts down the Eviction thread.
|
activateTimeSource, cacheWriter, clear, close, configuration, containsKey, enableManagement, enableStatistics, expireUntil, gatedHolder, get, getAndPut, getAndReplace, getCacheHitrate, id, isClosed, isManagementEnabled, isStatisticsEnabled, iterator, iteratorWithTouch, joinSimple, jsr107cache, keySet, listeners, put, put, putIfAbsent, putIfAbsent, putToMap, remove, remove, removeAndRelease, replace, reportSize, setLogger, size, statistics, statisticsCalculator, stopAndClear, toString, uncaughtExceptionprotected EvictionInterface<K,V> evictionClass
protected final AtomicLong evictionCount
public CacheLimit(TCacheFactory factory, Builder<K,V> builder)
protected boolean isFull()
protected boolean isOverfull()
protected int evictionExtraSpace(Builder<K,V> builder)
Internally this method calculates some more numbers: 0 // Empty private int evictUntilAtLeast; // Position below userDataElements private int userDataElements; // Expected elements, as given by user private int blockStartAt; // Block mark private int evictNormallyElements; // SET DURING CONSTRUCTION
evictionExtraSpace in class Cache<K,V>builder - The builder containing the configurationprotected int elementsToRemove()
evictUntilAtLeast, userDataElements]. Typically we would try to
evict evictNormallyElements elements.public void shutdownCustomImpl()
protected boolean ensureFreeCapacity()
ensureFreeCapacity in class Cache<K,V>protected TCacheStatisticsInterface fillCacheStatistics(TCacheStatisticsInterface cacheStatistic)
CachefillCacheStatistics in class Cache<K,V>cacheStatistic - The statistics object to fillprotected String configToString()
configToString in class Cache<K,V>protected String evictionConfigInfo()
Copyright © 2018 trivago. All rights reserved.