org.apache.jcs.auxiliary
Class AbstractAuxiliaryCache

java.lang.Object
  extended by org.apache.jcs.auxiliary.AbstractAuxiliaryCache
All Implemented Interfaces:
java.io.Serializable, AuxiliaryCache, ICache, ICacheType
Direct Known Subclasses:
AbstractAuxiliaryCacheEventLogging, AbstractRemoteCacheNoWaitFacade, LateralCacheNoWait, LateralCacheNoWaitFacade, RemoteCacheNoWait

public abstract class AbstractAuxiliaryCache
extends java.lang.Object
implements AuxiliaryCache

This holds convenience methods used by most auxiliary caches.

See Also:
Serialized Form

Field Summary
protected  ICacheEventLogger cacheEventLogger
          An optional event logger
protected  IElementSerializer elementSerializer
          The serializer.
protected  IKeyMatcher keyMatcher
          Key matcher used by the getMatching API
 
Fields inherited from interface org.apache.jcs.engine.behavior.ICacheType
CACHE_HUB, DISK_CACHE, LATERAL_CACHE, REMOTE_CACHE
 
Constructor Summary
AbstractAuxiliaryCache()
           
 
Method Summary
protected  ICacheEvent createICacheEvent(ICacheElement item, java.lang.String eventName)
          Logs an event if an event logger is configured.
protected  ICacheEvent createICacheEvent(java.lang.String regionName, java.io.Serializable key, java.lang.String eventName)
          Logs an event if an event logger is configured.
 ICacheEventLogger getCacheEventLogger()
          Allows it to be injected.
 IElementSerializer getElementSerializer()
          Allows it to be injected.
abstract  java.lang.String getEventLoggingExtraInfo()
          Gets the extra info for the event log.
 IKeyMatcher getKeyMatcher()
          Rerturns the key matcher used by get matching.
protected  void logApplicationEvent(java.lang.String source, java.lang.String eventName, java.lang.String optionalDetails)
          Logs an event if an event logger is configured.
protected  void logError(java.lang.String source, java.lang.String eventName, java.lang.String errorMessage)
          Logs an event if an event logger is configured.
protected  void logICacheEvent(ICacheEvent cacheEvent)
          Logs an event if an event logger is configured.
 void setCacheEventLogger(ICacheEventLogger cacheEventLogger)
          Allows it to be injected.
 void setElementSerializer(IElementSerializer elementSerializer)
          Allows you to inject a custom serializer.
 void setKeyMatcher(IKeyMatcher keyMatcher)
          Sets the key matcher used by get matching.
 
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
dispose, get, getCacheName, getMatching, getMultiple, getSize, getStats, getStatus, remove, removeAll, update
 
Methods inherited from interface org.apache.jcs.engine.behavior.ICacheType
getCacheType
 

Field Detail

cacheEventLogger

protected ICacheEventLogger cacheEventLogger
An optional event logger


elementSerializer

protected IElementSerializer elementSerializer
The serializer. Uses a standard serializer by default.


keyMatcher

protected IKeyMatcher keyMatcher
Key matcher used by the getMatching API

Constructor Detail

AbstractAuxiliaryCache

public AbstractAuxiliaryCache()
Method Detail

createICacheEvent

protected ICacheEvent createICacheEvent(ICacheElement item,
                                        java.lang.String eventName)
Logs an event if an event logger is configured.

Parameters:
item -
eventName -
Returns:
ICacheEvent

createICacheEvent

protected ICacheEvent createICacheEvent(java.lang.String regionName,
                                        java.io.Serializable key,
                                        java.lang.String eventName)
Logs an event if an event logger is configured.

Parameters:
regionName -
key -
eventName -
Returns:
ICacheEvent

logICacheEvent

protected void logICacheEvent(ICacheEvent cacheEvent)
Logs an event if an event logger is configured.

Parameters:
cacheEvent -

logApplicationEvent

protected void logApplicationEvent(java.lang.String source,
                                   java.lang.String eventName,
                                   java.lang.String optionalDetails)
Logs an event if an event logger is configured.

Parameters:
source -
eventName -
optionalDetails -

logError

protected void logError(java.lang.String source,
                        java.lang.String eventName,
                        java.lang.String errorMessage)
Logs an event if an event logger is configured.

Parameters:
source -
eventName -
errorMessage -

getEventLoggingExtraInfo

public abstract java.lang.String getEventLoggingExtraInfo()
Gets the extra info for the event log.

Returns:
IP, or disk location, etc.

setCacheEventLogger

public void setCacheEventLogger(ICacheEventLogger cacheEventLogger)
Allows it to be injected.

Specified by:
setCacheEventLogger in interface AuxiliaryCache
Parameters:
cacheEventLogger -

getCacheEventLogger

public ICacheEventLogger getCacheEventLogger()
Allows it to be injected.

Returns:
cacheEventLogger

setElementSerializer

public void setElementSerializer(IElementSerializer elementSerializer)
Allows you to inject a custom serializer. A good example would be a compressing standard serializer.

Does not allow you to set it to null.

Specified by:
setElementSerializer in interface AuxiliaryCache
Parameters:
elementSerializer -

getElementSerializer

public IElementSerializer getElementSerializer()
Allows it to be injected.

Returns:
elementSerializer

setKeyMatcher

public void setKeyMatcher(IKeyMatcher keyMatcher)
Sets the key matcher used by get matching.

Specified by:
setKeyMatcher in interface ICache
Parameters:
keyMatcher -

getKeyMatcher

public IKeyMatcher getKeyMatcher()
Rerturns the key matcher used by get matching.

Returns:
keyMatcher


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