Package com.tangosol.net.cache
Class CompactSerializationCache.WrapperEvictionPolicy
- java.lang.Object
-
- com.tangosol.net.cache.CompactSerializationCache.InternalEvictionPolicy
-
- com.tangosol.net.cache.CompactSerializationCache.WrapperEvictionPolicy
-
- All Implemented Interfaces:
ConfigurableCacheMap.EvictionPolicy
- Enclosing class:
- CompactSerializationCache
protected class CompactSerializationCache.WrapperEvictionPolicy extends CompactSerializationCache.InternalEvictionPolicy
WrapperEvictionPolicy is used to wrap external or "custom" EvictionPolicy implementations to adapt the internal Binary key-based API to theEntry-basedAPI.
-
-
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 ConfigurableCacheMap.EvictionPolicyf_policyThe underlying (custom) EvictionPolicy.-
Fields inherited from class com.tangosol.net.cache.CompactSerializationCache.InternalEvictionPolicy
f_visitorTouchCount, f_visitorTouchTime, m_ldtLastEvict
-
-
Constructor Summary
Constructors Constructor Description WrapperEvictionPolicy(ConfigurableCacheMap.EvictionPolicy policy)Construct a WrapperEvictionPolicy.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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 ConfigurableCacheMap.EvictionPolicygetConfiguredPolicy()Return theconfiguredEvictionPolicy instance.voidrequestEviction(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
getName, touchInternal
-
-
-
-
Field Detail
-
f_policy
protected final ConfigurableCacheMap.EvictionPolicy f_policy
The underlying (custom) EvictionPolicy.
-
-
Constructor Detail
-
WrapperEvictionPolicy
public WrapperEvictionPolicy(ConfigurableCacheMap.EvictionPolicy policy)
Construct a WrapperEvictionPolicy.- Parameters:
policy- the underlying EvictionPolicy
-
-
Method Detail
-
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.- Overrides:
entryTouchedin classCompactSerializationCache.InternalEvictionPolicy- Parameters:
binKey- the key
-
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- Overrides:
entryTouchedin classCompactSerializationCache.InternalEvictionPolicy- Parameters:
entry- the Cache Entry that has been touched
-
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:
calculateWeightin classCompactSerializationCache.InternalEvictionPolicy- Parameters:
binKey- the key to calculate the weight for- Returns:
- the weight of the entry
-
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- Overrides:
requestEvictionin classCompactSerializationCache.InternalEvictionPolicy- Parameters:
cMaximum- the maximum number of units that should remain in the cache when the eviction is complete
-
getConfiguredPolicy
protected ConfigurableCacheMap.EvictionPolicy getConfiguredPolicy()
Return theconfiguredEvictionPolicy instance.- Specified by:
getConfiguredPolicyin classCompactSerializationCache.InternalEvictionPolicy- Returns:
- the configured EvictionPolicy
-
-