public abstract class AbstractIndexedDiskCache<K extends Serializable,V extends Serializable> extends AbstractMapBackedCustomTtlCache<K,V,BlockMetaData>
| Modifier and Type | Field and Description |
|---|---|
protected DataFile |
dataFile |
protected Object |
dataFileLock |
protected IndexFile |
indexFile |
protected Object |
indexFileLock |
protected File |
lockFile |
protected int |
queueSizeWarningLimit |
UNLIMITED_IDLE_TIME| Constructor and Description |
|---|
AbstractIndexedDiskCache(String name,
long defaultTimeToLive,
int maxSize,
int recycleSize,
File baseDir) |
AbstractIndexedDiskCache(String name,
long defaultTimeToLive,
long defaultMaxIdleTime,
int maxSize,
int recycleSize,
File baseDir) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
buildIndex() |
protected void |
close()
Closes the cache.
|
protected abstract <T extends V> |
dataFromBytes(byte[] data) |
protected abstract <T extends V> |
dataToBytes(T data) |
protected void |
doDelete(K key,
BlockMetaData metaData)
Performs deletion of the data belonging to the metadata.
|
protected <T extends V> |
doGet(K key,
BlockMetaData metaData)
Performs retrieval of the data belonging to the metadata.
|
protected <T extends V> |
doPut(K key,
T data,
long timeToLive,
long maxIdleTime)
Performs storage of the given data and adds new metadata to the map.
|
void |
flush()
Flushes the writer thread.
|
int |
getWriteQueueLength()
Get the length of the writer thread queue.
|
boolean |
isWriterThreadAlive()
Checks if the writer thread is alive.
|
void |
setQueueSizeWarningLimit(int limit)
Set the limit when the writer thread is warning for an excess queue length.
|
doPut, put, put, putWithErrors, putWithErrorscleanUp, delete, delete, expunge, expunge, get, getCleanUpInterval, getComparator, getEntriesMetaData, getEntry, getMaxSize, getMetaData, getRecycleSize, getStatistics, getWithErrors, put, putEntry, putWithErrors, setCleanUpInterval, setMaxSize, setRecycleSize, triggerExpungegetCleanUpLogger, getDefaultMaxIdleTime, getDefaultTtl, getLogger, getName, setDefaultMaxIdleTime, setDefaultTtlclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcleanUp, delete, expunge, get, getDefaultMaxIdleTime, getDefaultTtl, getMetaData, getName, getStatistics, getWithErrors, put, putWithErrors, setDefaultTtlprotected Object indexFileLock
protected Object dataFileLock
protected final IndexFile indexFile
protected final DataFile dataFile
protected final File lockFile
protected int queueSizeWarningLimit
public AbstractIndexedDiskCache(String name, long defaultTimeToLive, int maxSize, int recycleSize, File baseDir) throws IOException
IOExceptionpublic AbstractIndexedDiskCache(String name, long defaultTimeToLive, long defaultMaxIdleTime, int maxSize, int recycleSize, File baseDir) throws IOException
IOExceptionpublic void setQueueSizeWarningLimit(int limit)
limit - The limit.public int getWriteQueueLength()
public boolean isWriterThreadAlive()
public void flush()
protected void close()
throws IOException
IOExceptionprotected void buildIndex()
throws IOException
IOExceptionprotected void doDelete(K key, BlockMetaData metaData) throws CacheException
AbstractMapBackedCachedoDelete in class AbstractMapBackedCache<K extends Serializable,V extends Serializable,BlockMetaData>CacheExceptionprotected <T extends V> T doGet(K key, BlockMetaData metaData) throws CacheException
AbstractMapBackedCachedoGet in class AbstractMapBackedCache<K extends Serializable,V extends Serializable,BlockMetaData>CacheExceptionprotected <T extends V> T doPut(K key, T data, long timeToLive, long maxIdleTime) throws CacheException
AbstractMapBackedCustomTtlCachedoPut in class AbstractMapBackedCustomTtlCache<K extends Serializable,V extends Serializable,BlockMetaData>CacheExceptionprotected abstract <T extends V> T dataFromBytes(byte[] data) throws CacheException
CacheExceptionprotected abstract <T extends V> byte[] dataToBytes(T data) throws CacheException
CacheExceptionCopyright © 2014 dontdrinkandroot. All rights reserved.