public class BlockDiskCache<K,V> extends AbstractDiskCache<K,V> implements IRequireScheduler
AbstractDiskCache.MyCacheListener
ICacheType.CacheType
alive, cacheEventQueue, cacheName, purgatory, purgHits, removeAllLock
Constructor and Description |
---|
BlockDiskCache(BlockDiskCacheAttributes cacheAttributes)
Constructs the BlockDisk after setting up the root directory.
|
BlockDiskCache(BlockDiskCacheAttributes cacheAttributes,
IElementSerializer elementSerializer)
Constructs the BlockDisk after setting up the root directory.
|
Modifier and Type | Method and Description |
---|---|
protected void |
disposeInternal()
Internal method that handles the disposal.
|
protected void |
freeBlocks(int[] blocksToFree)
Add these blocks to the emptyBlock list.
|
AuxiliaryCacheAttributes |
getAuxiliaryCacheAttributes()
Returns the attributes.
|
protected String |
getDiskLocation()
This is used by the event logging.
|
Set<K> |
getKeySet()
Return the keys in this cache.
|
int |
getSize()
Returns the number of keys.
|
IStats |
getStatistics()
Returns info about the disk cache.
|
String |
getStats()
Gets basic stats for the disk cache.
|
void |
processDispose()
Dispose of the disk cache in a background thread.
|
protected ICacheElement<K,V> |
processGet(K key)
Gets the ICacheElement
|
Map<K,ICacheElement<K,V>> |
processGetMatching(String pattern)
Gets matching items from the cache.
|
protected boolean |
processRemove(K key)
Returns true if the removal was successful; or false if there is nothing to remove.
|
protected void |
processRemoveAll()
Resets the keyfile, the disk file, and the memory key map.
|
protected void |
processUpdate(ICacheElement<K,V> element)
Writes an element to disk.
|
void |
setScheduledExecutorService(ScheduledExecutorService scheduledExecutor)
Inject an instance of a central ScheduledExecutorService
|
protected boolean |
verifyDisk()
We need to verify that the file on disk uses the same block size and that the file is the
proper size.
|
dispose, doDispose, doGet, doGetMatching, doRemove, doRemoveAll, doUpdate, get, getCacheName, getCacheType, getEventLoggingExtraInfo, getMatching, getStatus, processGetMultiple, remove, removeAll, update
disposeWithEventLogging, getMatchingWithEventLogging, getMultiple, getMultipleWithEventLogging, getWithEventLogging, 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
setCacheEventLogger, setElementSerializer
getMultiple, setKeyMatcher
public BlockDiskCache(BlockDiskCacheAttributes cacheAttributes)
cacheAttributes
- public BlockDiskCache(BlockDiskCacheAttributes cacheAttributes, IElementSerializer elementSerializer)
cacheAttributes
- elementSerializer
- used if supplied, the super's super will not set a nullpublic void setScheduledExecutorService(ScheduledExecutorService scheduledExecutor)
IRequireScheduler
setScheduledExecutorService
in interface IRequireScheduler
IRequireScheduler.setScheduledExecutorService(java.util.concurrent.ScheduledExecutorService)
protected boolean verifyDisk()
public Set<K> getKeySet() throws IOException
getKeySet
in interface AuxiliaryCache<K,V>
getKeySet
in class AbstractDiskCache<K,V>
IOException
- if access to the auxiliary cache failsAbstractDiskCache.getKeySet()
public Map<K,ICacheElement<K,V>> processGetMatching(String pattern)
processGetMatching
in class AbstractAuxiliaryCacheEventLogging<K,V>
pattern
- public int getSize()
(non-Javadoc)
getSize
in interface ICache<K,V>
getSize
in class AbstractDiskCache<K,V>
AbstractDiskCache.getSize()
protected ICacheElement<K,V> processGet(K key)
processGet
in class AbstractAuxiliaryCacheEventLogging<K,V>
key
- org.apache.commons.jcs.auxiliary.disk.AbstractDiskCache#doGet(java.io.Serializable)
protected void processUpdate(ICacheElement<K,V> element)
processUpdate
in class AbstractAuxiliaryCacheEventLogging<K,V>
element
- AbstractDiskCache.doUpdate(org.apache.commons.jcs.engine.behavior.ICacheElement)
protected boolean processRemove(K key)
(non-Javadoc)
processRemove
in class AbstractAuxiliaryCacheEventLogging<K,V>
key
- org.apache.commons.jcs.auxiliary.disk.AbstractDiskCache#doRemove(java.io.Serializable)
protected void processRemoveAll()
processRemoveAll
in class AbstractAuxiliaryCacheEventLogging<K,V>
AbstractDiskCache.doRemoveAll()
public void processDispose()
TODO make dispose window configurable.
processDispose
in class AbstractAuxiliaryCacheEventLogging<K,V>
protected void disposeInternal() throws InterruptedException
InterruptedException
public AuxiliaryCacheAttributes getAuxiliaryCacheAttributes()
(non-Javadoc)
getAuxiliaryCacheAttributes
in interface AuxiliaryCache<K,V>
AuxiliaryCache.getAuxiliaryCacheAttributes()
protected void freeBlocks(int[] blocksToFree)
blocksToFree
- public String getStats()
public IStats getStatistics()
(non-Javadoc)
getStatistics
in interface AuxiliaryCache<K,V>
getStatistics
in class AbstractDiskCache<K,V>
AuxiliaryCache.getStatistics()
protected String getDiskLocation()
getDiskLocation
in class AbstractDiskCache<K,V>
Copyright © 2002–2016 The Apache Software Foundation. All rights reserved.