org.apache.jcs.auxiliary
Class AbstractAuxiliaryCacheEventLogging

java.lang.Object
  extended by org.apache.jcs.auxiliary.AbstractAuxiliaryCache
      extended by org.apache.jcs.auxiliary.AbstractAuxiliaryCacheEventLogging
All Implemented Interfaces:
java.io.Serializable, AuxiliaryCache, ICache, ICacheType
Direct Known Subclasses:
AbstractDiskCache, AbstractRemoteAuxiliaryCache, LateralCache

public abstract class AbstractAuxiliaryCacheEventLogging
extends AbstractAuxiliaryCache

All ICacheEvents are defined as final. Children must implement process events. These are wrapped in event log parent calls.

You can override the public method, but if you don't, the default will call getWithTiming.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.jcs.auxiliary.AbstractAuxiliaryCache
cacheEventLogger, elementSerializer, keyMatcher
 
Fields inherited from interface org.apache.jcs.engine.behavior.ICacheType
CACHE_HUB, DISK_CACHE, LATERAL_CACHE, REMOTE_CACHE
 
Constructor Summary
AbstractAuxiliaryCacheEventLogging()
           
 
Method Summary
 void dispose()
          Synchronously dispose the remote cache; if failed, replace the remote handle with a zombie.
protected  void disposeWithEventLogging()
          Synchronously dispose the remote cache; if failed, replace the remote handle with a zombie.
 ICacheElement get(java.io.Serializable key)
          Gets the item from the cache.
 java.util.Map getMatching(java.lang.String pattern)
          Gets items from the cache matching the given pattern.
protected  java.util.Map getMatchingWithEventLogging(java.lang.String pattern)
          Gets mmatching items from the cache based on the given pattern.
 java.util.Map getMultiple(java.util.Set keys)
          Gets multiple items from the cache based on the given set of keys.
protected  java.util.Map getMultipleWithEventLogging(java.util.Set keys)
          Gets multiple items from the cache based on the given set of keys.
protected  ICacheElement getWithEventLogging(java.io.Serializable key)
          Gets the item from the cache.
protected abstract  void processDispose()
          Specific implementation of dispose.
protected abstract  ICacheElement processGet(java.io.Serializable key)
          Implementation of get.
protected abstract  java.util.Map processGetMatching(java.lang.String pattern)
          Implementation of getMatching.
protected abstract  java.util.Map processGetMultiple(java.util.Set keys)
          Implementation of getMultiple.
protected abstract  boolean processRemove(java.io.Serializable key)
          Specific implementation of remove.
protected abstract  void processRemoveAll()
          Specific implementation of removeAll.
protected abstract  void processUpdate(ICacheElement cacheElement)
          Implementation of put.
 boolean remove(java.io.Serializable key)
          Removes the item from the cache.
 void removeAll()
          Removes all from the region.
protected  void removeAllWithEventLogging()
          Removes all from the region.
protected  boolean removeWithEventLogging(java.io.Serializable key)
          Removes the item from the cache.
 void update(ICacheElement cacheElement)
          Puts an item into the cache.
protected  void updateWithEventLogging(ICacheElement cacheElement)
          Puts an item into the cache.
 
Methods inherited from class org.apache.jcs.auxiliary.AbstractAuxiliaryCache
createICacheEvent, createICacheEvent, getCacheEventLogger, getElementSerializer, getEventLoggingExtraInfo, getKeyMatcher, logApplicationEvent, logError, logICacheEvent, setCacheEventLogger, setElementSerializer, setKeyMatcher
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.jcs.auxiliary.AuxiliaryCache
getAuxiliaryCacheAttributes, getGroupKeys, getStatistics
 
Methods inherited from interface org.apache.jcs.engine.behavior.ICache
getCacheName, getSize, getStats, getStatus
 
Methods inherited from interface org.apache.jcs.engine.behavior.ICacheType
getCacheType
 

Constructor Detail

AbstractAuxiliaryCacheEventLogging

public AbstractAuxiliaryCacheEventLogging()
Method Detail

update

public void update(ICacheElement cacheElement)
            throws java.io.IOException
Puts an item into the cache.

Parameters:
cacheElement -
Throws:
java.io.IOException

updateWithEventLogging

protected final void updateWithEventLogging(ICacheElement cacheElement)
                                     throws java.io.IOException
Puts an item into the cache. Wrapped in logging.

Parameters:
cacheElement -
Throws:
java.io.IOException

processUpdate

protected abstract void processUpdate(ICacheElement cacheElement)
                               throws java.io.IOException
Implementation of put.

Parameters:
cacheElement -
Throws:
java.io.IOException

get

public ICacheElement get(java.io.Serializable key)
                  throws java.io.IOException
Gets the item from the cache.

Parameters:
key -
Returns:
ICacheElement, a wrapper around the key, value, and attributes
Throws:
java.io.IOException

getWithEventLogging

protected final ICacheElement getWithEventLogging(java.io.Serializable key)
                                           throws java.io.IOException
Gets the item from the cache. Wrapped in logging.

Parameters:
key -
Returns:
ICacheElement, a wrapper around the key, value, and attributes
Throws:
java.io.IOException

processGet

protected abstract ICacheElement processGet(java.io.Serializable key)
                                     throws java.io.IOException
Implementation of get.

Parameters:
key -
Returns:
ICacheElement, a wrapper around the key, value, and attributes
Throws:
java.io.IOException

getMultiple

public java.util.Map getMultiple(java.util.Set keys)
                          throws java.io.IOException
Gets multiple items from the cache based on the given set of keys.

Parameters:
keys -
Returns:
a map of Serializable key to ICacheElement element, or an empty map if there is no data in cache for any of these keys
Throws:
java.io.IOException

getMultipleWithEventLogging

protected final java.util.Map getMultipleWithEventLogging(java.util.Set keys)
                                                   throws java.io.IOException
Gets multiple items from the cache based on the given set of keys.

Parameters:
keys -
Returns:
a map of Serializable key to ICacheElement element, or an empty map if there is no data in cache for any of these keys
Throws:
java.io.IOException

processGetMultiple

protected abstract java.util.Map processGetMultiple(java.util.Set keys)
                                             throws java.io.IOException
Implementation of getMultiple.

Parameters:
keys -
Returns:
a map of Serializable key to ICacheElement element, or an empty map if there is no data in cache for any of these keys
Throws:
java.io.IOException

getMatching

public java.util.Map getMatching(java.lang.String pattern)
                          throws java.io.IOException
Gets items from the cache matching the given pattern. Items from memory will replace those from remote sources.

This only works with string keys. It's too expensive to do a toString on every key.

Auxiliaries will do their best to handle simple expressions. For instance, the JDBC disk cache will convert * to % and . to _

Parameters:
pattern -
Returns:
a map of Serializable key to ICacheElement element, or an empty map if there is no data matching the pattern.
Throws:
java.io.IOException

getMatchingWithEventLogging

protected final java.util.Map getMatchingWithEventLogging(java.lang.String pattern)
                                                   throws java.io.IOException
Gets mmatching items from the cache based on the given pattern.

Parameters:
pattern -
Returns:
a map of Serializable key to ICacheElement element, or an empty map if there is no data matching the pattern.
Throws:
java.io.IOException

processGetMatching

protected abstract java.util.Map processGetMatching(java.lang.String pattern)
                                             throws java.io.IOException
Implementation of getMatching.

Parameters:
pattern -
Returns:
a map of Serializable key to ICacheElement element, or an empty map if there is no data matching the pattern.
Throws:
java.io.IOException

remove

public boolean remove(java.io.Serializable key)
               throws java.io.IOException
Removes the item from the cache. Wraps the remove in event logs.

Parameters:
key -
Returns:
boolean, whether or not the item was removed
Throws:
java.io.IOException

removeWithEventLogging

protected final boolean removeWithEventLogging(java.io.Serializable key)
                                        throws java.io.IOException
Removes the item from the cache. Wraps the remove in event logs.

Parameters:
key -
Returns:
boolean, whether or not the item was removed
Throws:
java.io.IOException

processRemove

protected abstract boolean processRemove(java.io.Serializable key)
                                  throws java.io.IOException
Specific implementation of remove.

Parameters:
key -
Returns:
boolean, whether or not the item was removed
Throws:
java.io.IOException

removeAll

public void removeAll()
               throws java.io.IOException
Removes all from the region. Wraps the removeAll in event logs.

Throws:
java.io.IOException

removeAllWithEventLogging

protected final void removeAllWithEventLogging()
                                        throws java.io.IOException
Removes all from the region. Wraps the removeAll in event logs.

Throws:
java.io.IOException

processRemoveAll

protected abstract void processRemoveAll()
                                  throws java.io.IOException
Specific implementation of removeAll.

Throws:
java.io.IOException

dispose

public void dispose()
             throws java.io.IOException
Synchronously dispose the remote cache; if failed, replace the remote handle with a zombie.

Throws:
java.io.IOException

disposeWithEventLogging

protected final void disposeWithEventLogging()
                                      throws java.io.IOException
Synchronously dispose the remote cache; if failed, replace the remote handle with a zombie. Wraps the removeAll in event logs.

Throws:
java.io.IOException

processDispose

protected abstract void processDispose()
                                throws java.io.IOException
Specific implementation of dispose.

Throws:
java.io.IOException


Copyright © 2002-2009 Apache Software Foundation. All Rights Reserved.