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 the
Entry-based API.-
Nested Class Summary
Nested classes/interfaces inherited from class com.tangosol.net.cache.CompactSerializationCache.InternalEvictionPolicy
CompactSerializationCache.InternalEvictionPolicy.EvictionCandidate, CompactSerializationCache.InternalEvictionPolicy.EvictionVisitor -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ConfigurableCacheMap.EvictionPolicyThe underlying (custom) EvictionPolicy.Fields inherited from class com.tangosol.net.cache.CompactSerializationCache.InternalEvictionPolicy
f_visitorTouchCount, f_visitorTouchTime, m_ldtLastEvict -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a WrapperEvictionPolicy. -
Method Summary
Modifier and TypeMethodDescriptionprotected longcalculateWeight(Binary binKey) Calculate the "weight" of the entry associated with the specified key.voidThis 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.EvictionPolicyReturn 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 Details
-
f_policy
The underlying (custom) EvictionPolicy.
-
-
Constructor Details
-
WrapperEvictionPolicy
Construct a WrapperEvictionPolicy.- Parameters:
policy- the underlying EvictionPolicy
-
-
Method Details
-
entryTouched
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
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
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
Return theconfiguredEvictionPolicy instance.- Specified by:
getConfiguredPolicyin classCompactSerializationCache.InternalEvictionPolicy- Returns:
- the configured EvictionPolicy
-