public class BlockDiskCache<K,V> extends AbstractDiskCache<K,V> implements IRequireScheduler
AbstractDiskCache.MyCacheListenerICacheType.CacheTypeNAME_COMPONENT_DELIMITER| 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.
|
void |
processDispose()
Dispose of the disk cache in a background thread.
|
protected ICacheElement<K,V> |
processGet(K key)
Gets the ICacheElement<K, V> for the key if it is in the cache.
|
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, getStats, getStatus, isAlive, remove, removeAll, setAlive, updatedisposeWithEventLogging, getMatchingWithEventLogging, getMultiple, getMultipleWithEventLogging, getWithEventLogging, removeAllWithEventLogging, removeWithEventLogging, updateWithEventLoggingcreateICacheEvent, createICacheEvent, getCacheEventLogger, getElementSerializer, getKeyMatcher, logApplicationEvent, logError, logICacheEvent, processGetMultiple, setCacheEventLogger, setElementSerializer, setKeyMatcherpublic 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)
IRequireSchedulersetScheduledExecutorService in interface IRequireSchedulerIRequireScheduler.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 - AbstractDiskCache.get(Object)protected void processUpdate(ICacheElement<K,V> element)
processUpdate in class AbstractAuxiliaryCacheEventLogging<K,V>element - AbstractDiskCache.update(ICacheElement)protected boolean processRemove(K key)
processRemove in class AbstractAuxiliaryCacheEventLogging<K,V>key - AbstractDiskCache.remove(Object)protected void processRemoveAll()
processRemoveAll in class AbstractAuxiliaryCacheEventLogging<K,V>AbstractDiskCache.removeAll()public void processDispose()
TODO make dispose window configurable.
processDispose in class AbstractAuxiliaryCacheEventLogging<K,V>protected void disposeInternal()
public AuxiliaryCacheAttributes getAuxiliaryCacheAttributes()
getAuxiliaryCacheAttributes in interface AuxiliaryCache<K,V>AuxiliaryCache.getAuxiliaryCacheAttributes()protected void freeBlocks(int[] blocksToFree)
blocksToFree - public IStats getStatistics()
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–2022 The Apache Software Foundation. All rights reserved.