Interface ConfigurableCacheMap
- All Superinterfaces:
- CacheMap,- Map,- ObservableMap
- All Known Implementing Classes:
- BlindCompactSerializationCache,- CaffeineCache,- CompactSerializationCache,- LocalCache,- ObservableSplittingBackingCache,- OldCache,- SerializationCache
- Since:
- Coherence 3.5
- Author:
- cp 2009-01-13
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA cache Entry carries information additional to the base Map Entry in order to support eviction and expiry.static interfaceEvictionApprover is used to approve the eviction of an entry from the underlying ConfigurableCacheMap.static interfaceAn eviction policy is an object that the cache provides with access information, and when requested, the eviction policy selects and evicts entries from the cache.static interfaceA unit calculator is an object that can calculate the cost of caching an object.
- 
Field SummaryFields inherited from interface com.tangosol.net.cache.CacheMapEXPIRY_DEFAULT, EXPIRY_NEVER
- 
Method SummaryModifier and TypeMethodDescriptionvoidevict()Evict all entries from the cache that are no longer valid, and potentially prune the cache size if the cache is size-limited and its size is above the caching low water mark.voidEvict a specified key from the cache, as if it had expired from the cache.voidevictAll(Collection colKeys) Evict the specified keys from the cache, as if they had each expired from the cache.getCacheEntry(Object oKey) Locate a cache Entry in the cache based on its key.Obtain the registered EvictionApprover.Obtain the current EvictionPolicy used by the cache.intDetermine the default "time to live" for each individual cache entry.intDetermine the limit of the cache size in units.intDetermine the point to which the cache will shrink when it prunes.longDetermine the next expiry time for the cache entries.Obtain the current UnitCalculator used by the cache.intDetermine the factor by which the Units, LowUnits and HighUnits properties are adjusted.intgetUnits()Determine the number of units that the cache currently stores.voidSet the EvictionApprover for this ConfigurableCacheMap.voidSet the EvictionPolicy for the cache to use.voidsetExpiryDelay(int cMillis) Specify the default "time to live" for cache entries.voidsetHighUnits(int cMax) Update the maximum size of the cache in units.voidsetLowUnits(int cUnits) Specify the point to which the cache will shrink when it prunes.voidsetUnitCalculator(ConfigurableCacheMap.UnitCalculator calculator) Set the UnitCalculator for the cache to use.voidsetUnitFactor(int nFactor) Determine the factor by which the Units, LowUnits and HighUnits properties are adjusted.Methods inherited from interface java.util.Mapclear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuesMethods inherited from interface com.tangosol.util.ObservableMapaddMapListener, addMapListener, addMapListener, removeMapListener, removeMapListener, removeMapListener
- 
Method Details- 
getUnitsint getUnits()Determine the number of units that the cache currently stores.Note: It is expected that the return type will be widened to a long in Coherence 4. - Returns:
- the current size of the cache in units
 
- 
getHighUnitsint getHighUnits()Determine the limit of the cache size in units. The cache will prune itself automatically once it reaches its maximum unit level. This is often referred to as the "high water mark" of the cache.Note: It is expected that the return type will be widened to a long in Coherence 4. - Returns:
- the limit of the cache size in units
 
- 
setHighUnitsvoid setHighUnits(int cMax) Update the maximum size of the cache in units. This is often referred to as the "high water mark" of the cache.Note: It is expected that the parameter will be widened to a long in Coherence 4. - Parameters:
- cMax- the new maximum size of the cache, in units
 
- 
getLowUnitsint getLowUnits()Determine the point to which the cache will shrink when it prunes. This is often referred to as a "low water mark" of the cache. If the cache incrementally prunes, then this setting will have no effect.Note: It is expected that the parameter will be widened to a long in Coherence 4. - Returns:
- the number of units that the cache prunes to
 
- 
setLowUnitsvoid setLowUnits(int cUnits) Specify the point to which the cache will shrink when it prunes. This is often referred to as a "low water mark" of the cache.Note: It is expected that the parameter will be widened to a long in Coherence 4. - Parameters:
- cUnits- the number of units that the cache prunes to
 
- 
getUnitFactorint getUnitFactor()Determine the factor by which the Units, LowUnits and HighUnits properties are adjusted. Using a binary unit calculator, for example, the factor 1048576 could be used to count megabytes instead of bytes.Note: This property exists only to avoid changing the type of the units, low units and high units properties from 32-bit values to 64-bit values. It is expected that the parameter will be dropped in Coherence 4. - Returns:
- the units factor; the default is 1
 
- 
setUnitFactorvoid setUnitFactor(int nFactor) Determine the factor by which the Units, LowUnits and HighUnits properties are adjusted. Using a binary unit calculator, for example, the factor 1048576 could be used to count megabytes instead of bytes.Note: This property exists only to avoid changing the type of the units, low units and high units properties from 32-bit values to 64-bit values. It is expected that the parameter will be dropped in Coherence 4. - Parameters:
- nFactor- the units factor; the default is 1
 
- 
evictEvict a specified key from the cache, as if it had expired from the cache. If the key is not in the cache, then the method has no effect.- Parameters:
- oKey- the key to evict from the cache
 
- 
evictAllEvict the specified keys from the cache, as if they had each expired from the cache.The result of this method is defined to be semantically the same as the following implementation: for (Iterator iter = colKeys.iterator(); iter.hasNext(); ) { Object oKey = iter.next(); evict(oKey); }- Parameters:
- colKeys- a collection of keys to evict from the cache
 
- 
evictvoid evict()Evict all entries from the cache that are no longer valid, and potentially prune the cache size if the cache is size-limited and its size is above the caching low water mark.
- 
getEvictionApproverConfigurableCacheMap.EvictionApprover getEvictionApprover()Obtain the registered EvictionApprover.- Returns:
- the EvictionApprover (could be null)
 
- 
setEvictionApproverSet the EvictionApprover for this ConfigurableCacheMap.- Parameters:
- approver- the EvictionApprover
 
- 
getExpiryDelayint getExpiryDelay()Determine the default "time to live" for each individual cache entry.- Returns:
- the number of milliseconds that a cache entry value will live, or zero if cache entries are never automatically expired
 
- 
setExpiryDelayvoid setExpiryDelay(int cMillis) Specify the default "time to live" for cache entries. This does not affect the already-scheduled expiry of existing entries.- Parameters:
- cMillis- the number of milliseconds that cache entries will live, or zero to disable automatic expiry
 
- 
getNextExpiryTimelong getNextExpiryTime()Determine the next expiry time for the cache entries. This value is supposed to be used only by the "active" expiry algorithms, so for implementations that choose to return the value of zero the entries will be evicted as with pre-existing "passive" expiry approach.- Returns:
- the earliest time (using the SafeClock) that one or more cache entries will expire or zero if the cache is empty, its entries never expire or the implementation chooses to avoid the pro-active eviction
 
- 
getCacheEntryLocate a cache Entry in the cache based on its key.- Parameters:
- oKey- the key object to search for
- Returns:
- the Entry or null
 
- 
getEvictionPolicyConfigurableCacheMap.EvictionPolicy getEvictionPolicy()Obtain the current EvictionPolicy used by the cache.- Returns:
- the EvictionPolicy used by the cache
 
- 
setEvictionPolicySet the EvictionPolicy for the cache to use.- Parameters:
- policy- an EvictionPolicy
 
- 
getUnitCalculatorConfigurableCacheMap.UnitCalculator getUnitCalculator()Obtain the current UnitCalculator used by the cache.- Returns:
- the UnitCalculator used by the cache
 
- 
setUnitCalculatorSet the UnitCalculator for the cache to use.- Parameters:
- calculator- a UnitCalculator
 
 
-