Class AbstractAuxiliaryCache<K,V>
java.lang.Object
org.apache.commons.jcs3.auxiliary.AbstractAuxiliaryCache<K,V>
- All Implemented Interfaces:
AuxiliaryCache<K,
,V> ICache<K,
,V> ICacheType
- Direct Known Subclasses:
AbstractAuxiliaryCacheEventLogging
,AbstractRemoteCacheNoWaitFacade
,LateralCacheNoWait
,LateralCacheNoWaitFacade
,RemoteCacheNoWait
This holds convenience methods used by most auxiliary caches.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.commons.jcs3.engine.behavior.ICacheType
ICacheType.CacheType
-
Field Summary
Fields inherited from interface org.apache.commons.jcs3.engine.behavior.ICache
NAME_COMPONENT_DELIMITER
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected <T> ICacheEvent<T>
createICacheEvent
(String regionName, T key, String eventName) Logs an event if an event logger is configured.protected ICacheEvent<K>
createICacheEvent
(ICacheElement<K, V> item, String eventName) Logs an event if an event logger is configured.abstract ICacheElement<K,
V> Gets the item from the cache.Allows it to be injected.Allows it to be injected.abstract String
Gets the extra info for the event log.Returns the key matcher used by get matching.protected void
logApplicationEvent
(String source, String eventName, String optionalDetails) Logs an event if an event logger is configured.protected void
Logs an event if an event logger is configured.protected <T> void
logICacheEvent
(ICacheEvent<T> cacheEvent) Logs an event if an event logger is configured.protected Map<K,
ICacheElement<K, V>> processGetMultiple
(Set<K> keys) Gets multiple items from the cache based on the given set of keys.void
setCacheEventLogger
(ICacheEventLogger cacheEventLogger) Allows it to be injected.void
setElementSerializer
(IElementSerializer elementSerializer) Allows you to inject a custom serializer.void
setKeyMatcher
(IKeyMatcher<K> 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.commons.jcs3.auxiliary.AuxiliaryCache
getAuxiliaryCacheAttributes, getKeySet, getStatistics
Methods inherited from interface org.apache.commons.jcs3.engine.behavior.ICache
dispose, getCacheName, getMatching, getMultiple, getSize, getStats, getStatus, remove, removeAll, update
Methods inherited from interface org.apache.commons.jcs3.engine.behavior.ICacheType
getCacheType
-
Constructor Details
-
AbstractAuxiliaryCache
public AbstractAuxiliaryCache()
-
-
Method Details
-
processGetMultiple
Gets multiple items from the cache based on the given set of keys.- Parameters:
keys
-- Returns:
- a map of K key to ICacheElement<K, V> element, or an empty map if there is no data in cache for any of these keys
- Throws:
IOException
-
get
Gets the item from the cache.- Specified by:
get
in interfaceICache<K,
V> - Parameters:
key
-- Returns:
- ICacheElement, a wrapper around the key, value, and attributes
- Throws:
IOException
-
createICacheEvent
Logs an event if an event logger is configured.- Parameters:
item
-eventName
-- Returns:
- ICacheEvent
-
createICacheEvent
Logs an event if an event logger is configured.- Parameters:
regionName
-key
-eventName
-- Returns:
- ICacheEvent
-
logICacheEvent
Logs an event if an event logger is configured.- Parameters:
cacheEvent
-
-
logApplicationEvent
Logs an event if an event logger is configured.- Parameters:
source
-eventName
-optionalDetails
-
-
logError
Logs an event if an event logger is configured.- Parameters:
source
-eventName
-errorMessage
-
-
getEventLoggingExtraInfo
Gets the extra info for the event log.- Returns:
- IP, or disk location, etc.
-
setCacheEventLogger
Allows it to be injected.- Specified by:
setCacheEventLogger
in interfaceAuxiliaryCache<K,
V> - Parameters:
cacheEventLogger
-
-
getCacheEventLogger
Allows it to be injected.- Returns:
- cacheEventLogger
-
setElementSerializer
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 interfaceAuxiliaryCache<K,
V> - Parameters:
elementSerializer
-
-
getElementSerializer
Allows it to be injected.- Returns:
- elementSerializer
-
setKeyMatcher
Sets the key matcher used by get matching.- Specified by:
setKeyMatcher
in interfaceICache<K,
V> - Parameters:
keyMatcher
-
-
getKeyMatcher
Returns the key matcher used by get matching.- Returns:
- keyMatcher
-