Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.database
Class ShortTermQueryCache

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
                      extended by com.jivesoftware.forum.database.ShortTermQueryCache
All Implemented Interfaces:
Cache, com.tangosol.net.cache.CacheMap, com.tangosol.util.ObservableMap, java.io.Serializable, java.lang.Cloneable, java.util.Map

public class ShortTermQueryCache
extends CoherenceCache

An extension of the default cache to temporarily store query results before they are reloaded from the databases. Objects are automatically moved from a long-term cache into a short-term cache (instance of this class). When accessed for the first time, a query update task is scheduled to reload the data from the database and then move the cache entry from the short-term cache to the long-term cache. This system guarantees that threads are never blocked on trying to read data from query results after cache entry invalidations. This is important for sites with extreme performance needs. The consequence is that query results are not always "fresh". For example, a new thread may not appear in the list of threads in a forum until a short amount of time has passed.

See Also:
Serialized Form

Nested Class Summary
 class ShortTermQueryCache.Entry
           
static class ShortTermQueryCache.ValueWrapper
          Wraps an items going into the Short-term query cache and includes the ID of the cluster member that put the value into cache.
 
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
ShortTermQueryCache()
          Default constructor for coherence to create instances.
ShortTermQueryCache(int maxSize)
           
ShortTermQueryCache(int maxSize, int maxLifetime)
           
ShortTermQueryCache(int maxSize, int maxLifetime, com.tangosol.net.cache.CacheLoader loader)
           
ShortTermQueryCache(java.lang.String name, int maxSize, long maxLifetime)
          Create a new cache and specify the maximum size of for the cache in bytes, and the maximum lifetime of objects.
 
Method Summary
 com.tangosol.util.SafeHashMap.Entry getEntry(java.lang.Object key)
           
 edu.emory.mathcs.backport.java.util.concurrent.Executor getExecutor()
          Returns the executor used to process background updates of cache items.
protected static int getMemberID()
          Returns the cluster member ID, or 1 if clustering isn't enabled.
protected  com.tangosol.util.SafeHashMap.Entry instantiateEntry()
           
 
Methods inherited from class com.jivesoftware.util.CoherenceCache
getCacheSize, getMaxCacheSize, getMaxLifetime, getName, put, setMaxCacheSize, setMaxLifetime, setName
 
Methods inherited from class com.tangosol.net.cache.LocalCache
clear, get, getAll, getCacheLoader, getCacheStore, 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

ShortTermQueryCache

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


ShortTermQueryCache

public ShortTermQueryCache(int maxSize)

ShortTermQueryCache

public ShortTermQueryCache(int maxSize,
                           int maxLifetime)

ShortTermQueryCache

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

ShortTermQueryCache

public ShortTermQueryCache(java.lang.String name,
                           int maxSize,
                           long maxLifetime)
Create a new cache and specify the maximum size of for the cache in bytes, and the maximum lifetime of objects.

Parameters:
name - a name for the cache.
maxSize - the maximum size of the cache in bytes.
maxLifetime - the maximum amount of time objects can exist in cache before being deleted. -1 means objects never expire.
Method Detail

getExecutor

public edu.emory.mathcs.backport.java.util.concurrent.Executor getExecutor()
Returns the executor used to process background updates of cache items. Access to the executor is primarily provided for diagnostic purposes..

Returns:
the executor that processes background updates of cache items.

getEntry

public com.tangosol.util.SafeHashMap.Entry getEntry(java.lang.Object key)
Overrides:
getEntry in class com.tangosol.net.cache.LocalCache

getMemberID

protected static int getMemberID()
Returns the cluster member ID, or 1 if clustering isn't enabled.

Returns:
the cluster member ID or 1 if clustering isn't enabled.

instantiateEntry

protected com.tangosol.util.SafeHashMap.Entry instantiateEntry()
Overrides:
instantiateEntry in class CoherenceCache

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.