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.CacheType
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() |
Map<K,ICacheElement<K,V>> |
processGetMultiple(Set<K> keys)
Gets multiple items from the cache based on the given set of keys.
|
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, updateWithEventLogging
createICacheEvent, createICacheEvent, getCacheEventLogger, getElementSerializer, getKeyMatcher, logApplicationEvent, logError, logICacheEvent, setCacheEventLogger, setElementSerializer, setKeyMatcher
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAuxiliaryCacheAttributes
protected 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
- IOException
ICache.update(org.apache.commons.jcs.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
- IOException
public Map<K,ICacheElement<K,V>> processGetMultiple(Set<K> keys)
processGetMultiple
in class AbstractAuxiliaryCacheEventLogging<K,V>
keys
- public 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
- IOException
ICache.remove(K)
public final void removeAll() throws IOException
AbstractAuxiliaryCacheEventLogging
removeAll
in interface ICache<K,V>
removeAll
in class AbstractAuxiliaryCacheEventLogging<K,V>
IOException
ICache.removeAll()
public final void dispose() throws IOException
dispose
in interface ICache<K,V>
dispose
in class AbstractAuxiliaryCacheEventLogging<K,V>
IOException
public String getCacheName()
ICache
ICache.getCacheName()
public String getStats()
public IStats getStatistics()
AuxiliaryCache.getStatistics()
public CacheStatus getStatus()
ICache
ICache.getStatus()
public abstract int getSize()
ICache.getSize()
public ICacheType.CacheType getCacheType()
ICacheType
ICacheType.getCacheType()
protected final ICacheElement<K,V> doGet(K key) throws IOException
key
- Key to locate value for.IOException
protected final Map<K,ICacheElement<K,V>> doGetMatching(String pattern) throws IOException
pattern
- Used to match keys.IOException
protected final void doUpdate(ICacheElement<K,V> cacheElement) throws IOException
cacheElement
- IOException
protected final boolean doRemove(K key) throws IOException
key
- Key of object to remove.IOException
protected final void doRemoveAll() throws IOException
IOException
protected final void doDispose() throws IOException
IOException
public String getEventLoggingExtraInfo()
getEventLoggingExtraInfo
in class AbstractAuxiliaryCache<K,V>
protected abstract String getDiskLocation()
Copyright © 2002–2019 The Apache Software Foundation. All rights reserved.