Package com.tangosol.net.cache
Class CompactSerializationCache.HybridEvictionPolicy
- java.lang.Object
-
- com.tangosol.net.cache.CompactSerializationCache.InternalEvictionPolicy
-
- com.tangosol.net.cache.CompactSerializationCache.HybridEvictionPolicy
-
- All Implemented Interfaces:
ConfigurableCacheMap.EvictionPolicy
- Enclosing class:
- CompactSerializationCache
protected class CompactSerializationCache.HybridEvictionPolicy extends CompactSerializationCache.InternalEvictionPolicy
The EvictionPolicy object for the Hybrid eviction algorithm.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.tangosol.net.cache.CompactSerializationCache.InternalEvictionPolicy
CompactSerializationCache.InternalEvictionPolicy.EvictionCandidate, CompactSerializationCache.InternalEvictionPolicy.EvictionVisitor
-
-
Field Summary
Fields Modifier and Type Field Description protected CompactSerializationCache.TouchCountVisitor
f_visitor
The singleton TouchCountVisitor (eviction is single-threaded).protected int
m_cTouchesAvg
The average number of touches that each entry in the cache has.-
Fields inherited from class com.tangosol.net.cache.CompactSerializationCache.InternalEvictionPolicy
f_visitorTouchCount, f_visitorTouchTime, m_ldtLastEvict
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
HybridEvictionPolicy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected long
calculateWeight(Binary binKey)
Calculate the "weight" of the entry associated with the specified key.protected ConfigurableCacheMap.EvictionPolicy
getConfiguredPolicy()
Return theconfigured
EvictionPolicy instance.void
requestEviction(int cMaximum)
This method is called by the cache when the cache requires the eviction policy to evict entries.-
Methods inherited from class com.tangosol.net.cache.CompactSerializationCache.InternalEvictionPolicy
entryTouched, entryTouched, getName, touchInternal
-
-
-
-
Field Detail
-
m_cTouchesAvg
protected transient int m_cTouchesAvg
The average number of touches that each entry in the cache has. Used during the iteration (evict-set calculation) only.
-
f_visitor
protected final CompactSerializationCache.TouchCountVisitor f_visitor
The singleton TouchCountVisitor (eviction is single-threaded).
-
-
Method Detail
-
requestEviction
public void requestEviction(int cMaximum)
This method is called by the cache when the cache requires the eviction policy to evict entries.- Specified by:
requestEviction
in interfaceConfigurableCacheMap.EvictionPolicy
- Overrides:
requestEviction
in classCompactSerializationCache.InternalEvictionPolicy
- Parameters:
cMaximum
- the maximum number of units that should remain in the cache when the eviction is complete
-
calculateWeight
protected long calculateWeight(Binary binKey)
Calculate the "weight" of the entry associated with the specified key. The weight is a quantitative measure of how to prioritize the eviction of this entry w.r.t. the other cache entries. Entries with a smaller weights are of higher priority and are preferred over entries with larger weights for eviction.- Specified by:
calculateWeight
in classCompactSerializationCache.InternalEvictionPolicy
- Parameters:
binKey
- the key to calculate the weight for- Returns:
- the weight of the entry
-
getConfiguredPolicy
protected ConfigurableCacheMap.EvictionPolicy getConfiguredPolicy()
Return theconfigured
EvictionPolicy instance.- Specified by:
getConfiguredPolicy
in classCompactSerializationCache.InternalEvictionPolicy
- Returns:
- the configured EvictionPolicy
-
-