public class BufferedSerializableIndexedDiskCache extends SerializableIndexedDiskCache
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.| Modifier and Type | Field and Description |
|---|---|
protected ExpungeStrategy |
bufferExpungeStrategy |
dataFile, indexFile, lockFileUNLIMITED_IDLE_TIME| Constructor and Description |
|---|
BufferedSerializableIndexedDiskCache(String name,
long defaultTimeToLive,
ExpungeStrategy expungeStrategy,
File baseDir,
ExpungeStrategy bufferExpungeStrategy) |
BufferedSerializableIndexedDiskCache(String name,
long defaultTimeToLive,
long defaultMaxIdleTime,
ExpungeStrategy expungeStrategy,
File baseDir,
ExpungeStrategy bufferExpungeStrategy) |
| 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.
|
SimpleCacheStatistics |
getBufferStatistics()
Get the cache statistics of the buffer.
|
boolean |
isCopyOnRead() |
boolean |
isCopyOnWrite() |
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, closedoPut, put, put, putWithErrors, putWithErrorscleanUp, delete, delete, expunge, get, getEntriesMetaData, getEntriesMetaDataMap, getExpungeStrategy, getMetaData, getStatistics, getWithErrors, put, putWithErrors, setEntriesMetaDataMap, setExpungeStrategygetCleanUpLogger, getDefaultMaxIdleTime, getDefaultTtl, getLogger, getName, setDefaultMaxIdleTime, setDefaultTtlclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcleanUp, delete, get, getDefaultMaxIdleTime, getDefaultTtl, getMetaData, getName, getStatistics, getWithErrors, put, putWithErrorsprotected final ExpungeStrategy bufferExpungeStrategy
public BufferedSerializableIndexedDiskCache(String name, long defaultTimeToLive, ExpungeStrategy expungeStrategy, File baseDir, ExpungeStrategy bufferExpungeStrategy) throws IOException
IOExceptionpublic BufferedSerializableIndexedDiskCache(String name, long defaultTimeToLive, long defaultMaxIdleTime, ExpungeStrategy expungeStrategy, File baseDir, ExpungeStrategy bufferExpungeStrategy) 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>CacheExceptionprotected <T extends Serializable> T copyData(T data)
public boolean isCopyOnRead()
public boolean isCopyOnWrite()
public BufferedSerializableIndexedDiskCache setCopyOnRead(boolean copyOnRead)
public BufferedSerializableIndexedDiskCache setCopyOnWrite(boolean copyOnWrite)
Copyright © 2013 dontdrinkandroot. All Rights Reserved.