public abstract class AbstractDiskCache<K,V> extends AbstractAuxiliaryCacheEventLogging<K,V>
| Modifier and Type | Class and Description |
|---|---|
protected class |
AbstractDiskCache.MyCacheListener
Cache that implements the CacheListener interface, and calls appropriate methods in its
parent class.
|
ICacheType.CacheTypeNAME_COMPONENT_DELIMITER| Modifier | Constructor and Description |
|---|---|
protected |
AbstractDiskCache(IDiskCacheAttributes attr)
Construct the abstract disk cache, create event queues and purgatory.
|
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
Adds a dispose request to the disk cache.
|
protected void |
doDispose()
Dispose of the persistent store.
|
protected ICacheElement<K,V> |
doGet(K key)
Get a value from the persistent store.
|
protected Map<K,ICacheElement<K,V>> |
doGetMatching(String pattern)
Get a value from the persistent store.
|
protected boolean |
doRemove(K key)
Remove an object from the persistent store if found.
|
protected void |
doRemoveAll()
Remove all objects from the persistent store.
|
protected void |
doUpdate(ICacheElement<K,V> cacheElement)
Add a cache element to the persistent store.
|
ICacheElement<K,V> |
get(K key)
Check to see if the item is in purgatory.
|
String |
getCacheName()
Returns the cache name.
|
ICacheType.CacheType |
getCacheType()
Returns the cache type.
|
protected abstract String |
getDiskLocation()
This is used by the event logging.
|
String |
getEventLoggingExtraInfo()
Gets the extra info for the event log.
|
abstract Set<K> |
getKeySet()
The keys in the cache.
|
Map<K,ICacheElement<K,V>> |
getMatching(String pattern)
Gets items from the cache matching the given pattern.
|
abstract int |
getSize()
Size cannot be determined without knowledge of the cache implementation, so subclasses will
need to implement this method.
|
IStats |
getStatistics()
Returns semi-structured data.
|
String |
getStats()
Gets basic stats for the abstract disk cache.
|
CacheStatus |
getStatus()
Returns the cache status.
|
boolean |
isAlive() |
boolean |
remove(K key)
Removes are not queued.
|
void |
removeAll()
Removes all from the region.
|
void |
setAlive(boolean alive) |
void |
update(ICacheElement<K,V> cacheElement)
Adds the provided element to the cache.
|
disposeWithEventLogging, getMatchingWithEventLogging, getMultiple, getMultipleWithEventLogging, getWithEventLogging, processDispose, processGet, processGetMatching, processRemove, processRemoveAll, processUpdate, removeAllWithEventLogging, removeWithEventLogging, updateWithEventLoggingcreateICacheEvent, createICacheEvent, getCacheEventLogger, getElementSerializer, getKeyMatcher, logApplicationEvent, logError, logICacheEvent, processGetMultiple, setCacheEventLogger, setElementSerializer, setKeyMatcherclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAuxiliaryCacheAttributesprotected AbstractDiskCache(IDiskCacheAttributes attr)
attr - public boolean isAlive()
public void setAlive(boolean alive)
alive - set the alive statuspublic final void update(ICacheElement<K,V> cacheElement) throws IOException
update in interface ICache<K,V>update in class AbstractAuxiliaryCacheEventLogging<K,V>cacheElement - IOExceptionICache.update(org.apache.commons.jcs3.engine.behavior.ICacheElement<K, V>)public final ICacheElement<K,V> get(K key)
get in interface ICache<K,V>get in class AbstractAuxiliaryCacheEventLogging<K,V>key - ICache.get(K)public Map<K,ICacheElement<K,V>> getMatching(String pattern) throws IOException
getMatching in interface ICache<K,V>getMatching in class AbstractAuxiliaryCacheEventLogging<K,V>pattern - IOExceptionpublic abstract Set<K> getKeySet() throws IOException
IOException - if access to the auxiliary cache failsAuxiliaryCache.getKeySet()public final boolean remove(K key) throws IOException
remove in interface ICache<K,V>remove in class AbstractAuxiliaryCacheEventLogging<K,V>key - IOExceptionICache.remove(K)public final void removeAll()
throws IOException
AbstractAuxiliaryCacheEventLoggingremoveAll in interface ICache<K,V>removeAll in class AbstractAuxiliaryCacheEventLogging<K,V>IOExceptionICache.removeAll()public final void dispose()
throws IOException
dispose in interface ICache<K,V>dispose in class AbstractAuxiliaryCacheEventLogging<K,V>IOExceptionpublic String getCacheName()
ICacheICache.getCacheName()public String getStats()
public IStats getStatistics()
AuxiliaryCache.getStatistics()public CacheStatus getStatus()
ICacheICache.getStatus()public abstract int getSize()
ICache.getSize()public ICacheType.CacheType getCacheType()
ICacheTypeICacheType.getCacheType()protected final ICacheElement<K,V> doGet(K key) throws IOException
key - Key to locate value for.IOExceptionprotected final Map<K,ICacheElement<K,V>> doGetMatching(String pattern) throws IOException
pattern - Used to match keys.IOExceptionprotected final void doUpdate(ICacheElement<K,V> cacheElement) throws IOException
cacheElement - IOExceptionprotected final boolean doRemove(K key) throws IOException
key - Key of object to remove.IOExceptionprotected final void doRemoveAll()
throws IOException
IOExceptionprotected final void doDispose()
throws IOException
IOExceptionpublic String getEventLoggingExtraInfo()
getEventLoggingExtraInfo in class AbstractAuxiliaryCache<K,V>protected abstract String getDiskLocation()
Copyright © 2002–2022 The Apache Software Foundation. All rights reserved.