Package com.tangosol.net.cache
Class CompactSerializationCache.InternalEvictionPolicy
- java.lang.Object
-
- com.tangosol.net.cache.CompactSerializationCache.InternalEvictionPolicy
-
- All Implemented Interfaces:
ConfigurableCacheMap.EvictionPolicy
- Direct Known Subclasses:
CompactSerializationCache.HybridEvictionPolicy,CompactSerializationCache.LFUEvictionPolicy,CompactSerializationCache.LRUEvictionPolicy,CompactSerializationCache.WrapperEvictionPolicy
- Enclosing class:
- CompactSerializationCache
protected abstract class CompactSerializationCache.InternalEvictionPolicy extends Object implements ConfigurableCacheMap.EvictionPolicy
InternalEvictionPolicy is an abstract base implementation of anConfigurableCacheMap.EvictionPolicyused by this CompactSerializationCache.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classCompactSerializationCache.InternalEvictionPolicy.EvictionCandidateEvictionCandidate represents a candidate for eviction during the calculation of the eviction set, representing the key, its relative "weight" as assigned by the configuredConfigurableCacheMap.EvictionPolicyas well as its size in units.protected classCompactSerializationCache.InternalEvictionPolicy.EvictionVisitorSafeEntryVisitor implementation that calculates the set of eviction candidates.
-
Field Summary
Fields Modifier and Type Field Description protected BinaryLongMap.EntryVisitorf_visitorTouchCountThe singleton stateless visitor to update the touch-count map.protected BinaryLongMap.EntryVisitorf_visitorTouchTimeThe singleton stateless visitor to update the touch-time map.protected longm_ldtLastEvictThe date-time of the last eviction.
-
Constructor Summary
Constructors Modifier Constructor Description protectedInternalEvictionPolicy()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract longcalculateWeight(Binary binKey)Calculate the "weight" of the entry associated with the specified key.voidentryTouched(ConfigurableCacheMap.Entry entry)This method is called by the cache to indicate that an entry has been touched.voidentryTouched(Binary binKey)This method is called by the cache to indicate that the entry for the specified key has been touched.protected abstract ConfigurableCacheMap.EvictionPolicygetConfiguredPolicy()Return theconfiguredEvictionPolicy instance.StringgetName()Obtain the name of the eviction policy.voidrequestEviction(int cMaximum)This method is called by the cache when the cache requires the eviction policy to evict entries.protected voidtouchInternal(Binary binKey)Update the internally maintained "touch"-related statistics for the specified key (e.g. touch time and touch count).
-
-
-
Field Detail
-
m_ldtLastEvict
protected long m_ldtLastEvict
The date-time of the last eviction.
-
f_visitorTouchCount
protected final BinaryLongMap.EntryVisitor f_visitorTouchCount
The singleton stateless visitor to update the touch-count map.
-
f_visitorTouchTime
protected final BinaryLongMap.EntryVisitor f_visitorTouchTime
The singleton stateless visitor to update the touch-time map.
-
-
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:
requestEvictionin interfaceConfigurableCacheMap.EvictionPolicy- Parameters:
cMaximum- the maximum number of units that should remain in the cache when the eviction is complete
-
entryTouched
public void entryTouched(ConfigurableCacheMap.Entry entry)
This method is called by the cache to indicate that an entry has been touched.- Specified by:
entryTouchedin interfaceConfigurableCacheMap.EvictionPolicy- Parameters:
entry- the Cache Entry that has been touched
-
getName
public String getName()
Obtain the name of the eviction policy. This is intended to be human readable for use in a monitoring tool; examples include "LRU" and "LFU".- Specified by:
getNamein interfaceConfigurableCacheMap.EvictionPolicy- Returns:
- the name of the eviction policy
-
getConfiguredPolicy
protected abstract ConfigurableCacheMap.EvictionPolicy getConfiguredPolicy()
Return theconfiguredEvictionPolicy instance.- Returns:
- the configured EvictionPolicy
-
calculateWeight
protected abstract 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.- Parameters:
binKey- the key to calculate the weight for- Returns:
- the weight of the entry
-
entryTouched
public void entryTouched(Binary binKey)
This method is called by the cache to indicate that the entry for the specified key has been touched.- Parameters:
binKey- the key
-
touchInternal
protected void touchInternal(Binary binKey)
Update the internally maintained "touch"-related statistics for the specified key (e.g. touch time and touch count).- Parameters:
binKey- the key being touched
-
-