public class BufferedSerializableIndexedDiskCache extends SerializableIndexedDiskCache implements BufferedRecyclingCache<Serializable,Serializable>
SerializableIndexedDiskCache that buffers entries in memory on successful disk put and
get operations. The size and contents of the buffer are determined by a buffer
ExpungeStrategy that works the same way as a normal ExpungeStrategy but only on
the buffer entries.dataFile, dataFileLock, indexFile, indexFileLock, lockFile, queueSizeWarningLimitUNLIMITED_IDLE_TIME| Constructor and Description |
|---|
BufferedSerializableIndexedDiskCache(String name,
long defaultTimeToLive,
int maxSize,
int recycleSize,
File baseDir,
int bufferSize) |
BufferedSerializableIndexedDiskCache(String name,
long defaultTimeToLive,
long defaultMaxIdleTime,
int maxSize,
int recycleSize,
File baseDir,
int bufferSize) |
| Modifier and Type | Method and Description |
|---|---|
protected <T extends Serializable> |
copyData(T data)
Creates a copy of the given data.
|
protected void |
doDelete(Serializable key,
BlockMetaData metaData)
Performs deletion of the data belonging to the metadata.
|
protected <T extends Serializable> |
doGet(Serializable key,
BlockMetaData metaData)
Performs retrieval of the data belonging to the metadata.
|
protected <T extends Serializable> |
doPut(Serializable key,
T data,
long timeToLive,
long maxIdleTime)
Performs storage of the given data and adds new metadata to the map.
|
int |
getBufferSize() |
SimpleCacheStatistics |
getBufferStatistics()
Get the cache statistics of the buffer.
|
boolean |
isCopyOnRead() |
boolean |
isCopyOnWrite() |
void |
setBufferSize(int bufferSize) |
BufferedSerializableIndexedDiskCache |
setCopyOnRead(boolean copyOnRead)
Sets if a successful get should return a copy of the cache entry, so when manipulating the
object no changes are persisted in the buffer.
|
BufferedSerializableIndexedDiskCache |
setCopyOnWrite(boolean copyOnWrite)
Sets if a successful put should return a copy of the cache entry, so when manipulating the
object no changes are persisted in the buffer.
|
dataFromBytes, dataToBytes, getDataFileNumAllocatedBlocks, getIndexFileNumAllocatedBlocksbuildIndex, close, flush, getWriteQueueLength, isWriterThreadAlive, setQueueSizeWarningLimitdoPut, 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, waitgetMaxSize, getRecycleSize, setMaxSize, setRecycleSizecleanUp, delete, expunge, get, getDefaultMaxIdleTime, getDefaultTtl, getMetaData, getName, getStatistics, getWithErrors, put, putWithErrors, setDefaultTtlpublic BufferedSerializableIndexedDiskCache(String name, long defaultTimeToLive, int maxSize, int recycleSize, File baseDir, int bufferSize) throws IOException
IOExceptionpublic BufferedSerializableIndexedDiskCache(String name, long defaultTimeToLive, long defaultMaxIdleTime, int maxSize, int recycleSize, File baseDir, int bufferSize) throws IOException
IOExceptionpublic SimpleCacheStatistics getBufferStatistics()
protected <T extends Serializable> T doGet(Serializable key, BlockMetaData metaData) throws CacheException
AbstractMapBackedCachedoGet in class AbstractIndexedDiskCache<Serializable,Serializable>CacheExceptionprotected <T extends Serializable> T doPut(Serializable key, T data, long timeToLive, long maxIdleTime) throws CacheException
AbstractMapBackedCustomTtlCachedoPut in class AbstractIndexedDiskCache<Serializable,Serializable>CacheExceptionprotected void doDelete(Serializable key, BlockMetaData metaData) throws CacheException
AbstractMapBackedCachedoDelete in class AbstractIndexedDiskCache<Serializable,Serializable>CacheExceptionpublic int getBufferSize()
getBufferSize in interface BufferedRecyclingCache<Serializable,Serializable>public void setBufferSize(int bufferSize)
setBufferSize in interface BufferedRecyclingCache<Serializable,Serializable>protected <T extends Serializable> T copyData(T data)
public boolean isCopyOnRead()
public boolean isCopyOnWrite()
public BufferedSerializableIndexedDiskCache setCopyOnRead(boolean copyOnRead)
public BufferedSerializableIndexedDiskCache setCopyOnWrite(boolean copyOnWrite)
Copyright © 2014 dontdrinkandroot. All rights reserved.