Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.util
Class CoherenceCache

java.lang.Object
  extended by java.util.AbstractMap
      extended by com.tangosol.util.SafeHashMap
          extended by com.tangosol.net.cache.OldCache
              extended by com.tangosol.net.cache.LocalCache
                  extended by com.jivesoftware.util.CoherenceCache
All Implemented Interfaces:
Cache, com.tangosol.net.cache.CacheMap, com.tangosol.util.ObservableMap, java.io.Serializable, java.lang.Cloneable, java.util.Map
Direct Known Subclasses:
DbStatusLevelManager.LeaderQueryCache, ShortTermQueryCache

public class CoherenceCache
extends com.tangosol.net.cache.LocalCache
implements Cache

Implementation of the Cache interface that uses the Coherence LocalCache class.

See Also:
Serialized Form

Nested Class Summary
 class CoherenceCache.Entry
          A holder for a cached value.
 
Nested classes/interfaces inherited from class com.tangosol.net.cache.LocalCache
com.tangosol.net.cache.LocalCache.InternalListener, com.tangosol.net.cache.LocalCache.KeyMask
 
Nested classes/interfaces inherited from class com.tangosol.net.cache.OldCache
com.tangosol.net.cache.OldCache.EntrySet, com.tangosol.net.cache.OldCache.EvictionPolicy, com.tangosol.net.cache.OldCache.KeySet, com.tangosol.net.cache.OldCache.UnitCalculator, com.tangosol.net.cache.OldCache.ValuesCollection
 
Field Summary
 
Fields inherited from class com.tangosol.net.cache.LocalCache
DEFAULT_EXPIRE, DEFAULT_KEY_MASK, DEFAULT_UNITS
 
Fields inherited from class com.tangosol.net.cache.OldCache
DEFAULT_FLUSH, DEFAULT_PRUNE, EVICTION_POLICY_EXTERNAL, EVICTION_POLICY_HYBRID, EVICTION_POLICY_LFU, EVICTION_POLICY_LRU, m_calculator, m_cCurUnits, m_cExpiryDelay, m_cFlushDelay, m_cMaxUnits, m_cPruneUnits, m_listenerSupport, m_lNextFlush, m_nCalculatorType, m_nEvictionType, m_policy, m_stats, UNIT_CALCULATOR_BINARY, UNIT_CALCULATOR_EXTERNAL, UNIT_CALCULATOR_FIXED
 
Fields inherited from class com.tangosol.util.SafeHashMap
BIGGEST_MODULO, DEFAULT_GROWTHRATE, DEFAULT_INITIALSIZE, DEFAULT_LOADFACTOR, m_aeBucket, m_cCapacity, m_cEntries, m_colValues, m_flGrowthRate, m_flLoadFactor, m_oIterActive, m_setEntries, m_setKeys, PRIME_MODULO, RESIZING
 
Fields inherited from interface com.tangosol.net.cache.CacheMap
EXPIRY_DEFAULT, EXPIRY_NEVER
 
Constructor Summary
CoherenceCache()
          Default constructor for coherence to create instances.
CoherenceCache(int maxSize)
           
CoherenceCache(int maxSize, int maxLifetime)
           
CoherenceCache(int maxSize, int maxLifetime, com.tangosol.net.cache.CacheLoader loader)
           
CoherenceCache(java.lang.String name, int maxSize, long maxLifetime)
           
 
Method Summary
 int getCacheSize()
          Returns the size of the cache contents in bytes.
 int getMaxCacheSize()
          Returns the maximum size of the cache in bytes.
 long getMaxLifetime()
          Returns the maximum number of milliseconds that any object can live in cache.
 java.lang.String getName()
          Returns the name of the cache.
protected  com.tangosol.util.SafeHashMap.Entry instantiateEntry()
           
 java.lang.Object put(java.lang.Object oKey, java.lang.Object oValue, long cMillis)
          Function that overrides the put of the com.tangosol.net.cache.OldCache class.
 void setMaxCacheSize(int maxSize)
          Sets the maximum size of the cache in bytes.
 void setMaxLifetime(long maxLifetime)
          Sets the maximum number of milliseconds that any object can live in cache.
 void setName(java.lang.String name)
          Sets the name of the cache
 
Methods inherited from class com.tangosol.net.cache.LocalCache
clear, get, getAll, getCacheLoader, getCacheStore, getEntry, getKeyMask, instantiateInternalListener, instantiateMapEvent, load, loadAll, loadAll, peek, peekAll, remove, removeExpired, setCacheLoader, setKeyMask
 
Methods inherited from class com.tangosol.net.cache.OldCache
addMapListener, addMapListener, addMapListener, adjustUnits, checkFlush, checkSize, configureEviction, configureUnitCalculator, containsKey, deferFlush, dispatchEvent, evict, evict, evictAll, getCacheHits, getCacheMisses, getCacheStatistics, getEntryInternal, getEvictionPolicy, getEvictionType, getExpiryDelay, getFlushDelay, getFlushTime, getHighUnits, getHitProbability, getLowUnits, getMapListenerSupport, getUnitCalculator, getUnitCalculatorType, getUnits, hasListeners, instantiateEntrySet, instantiateKeySet, instantiateValuesCollection, prune, put, removeMapListener, removeMapListener, removeMapListener, resetHitStatistics, scheduleFlush, setEvictionPolicy, setEvictionType, setExpiryDelay, setFlushDelay, setFlushTime, setHighUnits, setLowUnits, setUnitCalculator, setUnitCalculatorType, size, toString
 
Methods inherited from class com.tangosol.util.SafeHashMap
clone, cloneEntryList, entrySet, getBucketIndex, getStableBucketArray, grow, isActiveIterator, isEmpty, iteratorActivated, iteratorDeactivated, keySet, removeEntryInternal, values
 
Methods inherited from class java.util.AbstractMap
containsValue, equals, hashCode, putAll
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.jivesoftware.util.Cache
getCacheHits, getCacheMisses
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from interface com.tangosol.net.cache.CacheMap
put
 
Methods inherited from interface com.tangosol.util.ObservableMap
addMapListener, addMapListener, addMapListener, removeMapListener, removeMapListener, removeMapListener
 

Constructor Detail

CoherenceCache

public CoherenceCache()
Default constructor for coherence to create instances.


CoherenceCache

public CoherenceCache(int maxSize)

CoherenceCache

public CoherenceCache(int maxSize,
                      int maxLifetime)

CoherenceCache

public CoherenceCache(int maxSize,
                      int maxLifetime,
                      com.tangosol.net.cache.CacheLoader loader)

CoherenceCache

public CoherenceCache(java.lang.String name,
                      int maxSize,
                      long maxLifetime)
Method Detail

put

public java.lang.Object put(java.lang.Object oKey,
                            java.lang.Object oValue,
                            long cMillis)
Function that overrides the put of the com.tangosol.net.cache.OldCache class. This is in relation to bug id COH-480 in the Tangosol bug tracking system.

Specified by:
put in interface com.tangosol.net.cache.CacheMap
Overrides:
put in class com.tangosol.net.cache.OldCache
Parameters:
oKey -
oValue -
cMillis -

getName

public java.lang.String getName()
Description copied from interface: Cache
Returns the name of the cache.

Specified by:
getName in interface Cache
Returns:
the name of the cache.

setName

public void setName(java.lang.String name)
Description copied from interface: Cache
Sets the name of the cache

Specified by:
setName in interface Cache
Parameters:
name - the name of the cache

getMaxCacheSize

public int getMaxCacheSize()
Description copied from interface: Cache
Returns the maximum size of the cache in bytes. If the cache grows larger than the max size, the least frequently used items will be removed. If the max cache size is set to -1, there is no size limit.

Specified by:
getMaxCacheSize in interface Cache
Returns:
the maximum size of the cache in bytes.

setMaxCacheSize

public void setMaxCacheSize(int maxSize)
Description copied from interface: Cache
Sets the maximum size of the cache in bytes. If the cache grows larger than the max size, the least frequently used items will be removed. If the max cache size is set to -1, there is no size limit.

Specified by:
setMaxCacheSize in interface Cache
Parameters:
maxSize - the maximum size of the cache in bytes.

getMaxLifetime

public long getMaxLifetime()
Description copied from interface: Cache
Returns the maximum number of milliseconds that any object can live in cache. Once the specified number of milliseconds passes, the object will be automatically expried from cache. If the max lifetime is set to -1, then objects never expire.

Specified by:
getMaxLifetime in interface Cache
Returns:
the maximum number of milliseconds before objects are expired.

setMaxLifetime

public void setMaxLifetime(long maxLifetime)
Description copied from interface: Cache
Sets the maximum number of milliseconds that any object can live in cache. Once the specified number of milliseconds passes, the object will be automatically expried from cache. If the max lifetime is set to -1, then objects never expire.

Specified by:
setMaxLifetime in interface Cache
Parameters:
maxLifetime - the maximum number of milliseconds before objects are expired.

getCacheSize

public int getCacheSize()
Description copied from interface: Cache
Returns the size of the cache contents in bytes. This value is only a rough approximation, so cache users should expect that actual VM memory used by the cache could be significantly higher than the value reported by this method.

Specified by:
getCacheSize in interface Cache
Returns:
the size of the cache contents in bytes.

instantiateEntry

protected com.tangosol.util.SafeHashMap.Entry instantiateEntry()
Overrides:
instantiateEntry in class com.tangosol.net.cache.LocalCache

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.