net.dontdrinkandroot.cache.impl.disk.indexed

## Class BufferedSerializableIndexedDiskCache

- java.lang.Object
- - net.dontdrinkandroot.cache.impl.AbstractCache<K,V>
  - - net.dontdrinkandroot.cache.impl.AbstractMapBackedCache<K,V,M>
    - - net.dontdrinkandroot.cache.impl.AbstractMapBackedCustomTtlCache<K,V,BlockMetaData>
      - - net.dontdrinkandroot.cache.impl.disk.indexed.AbstractIndexedDiskCache<Serializable,Serializable>
        - - net.dontdrinkandroot.cache.impl.disk.indexed.SerializableIndexedDiskCache
          - - net.dontdrinkandroot.cache.impl.disk.indexed.BufferedSerializableIndexedDiskCache

All Implemented Interfaces:
  Cache<Serializable,Serializable>, CustomTtlCache<Serializable,Serializable>

    public class BufferedSerializableIndexedDiskCache
    extends SerializableIndexedDiskCache

Author:
  Philip W. Sorst <philip@sorst.net>

### Field Summary

### Fields inherited from class net.dontdrinkandroot.cache.impl.disk.indexed.AbstractIndexedDiskCache

`dataFile, indexFile, lockFile`

### Fields inherited from interface net.dontdrinkandroot.cache.Cache

`UNLIMITED_IDLE_TIME`

### Constructor Summary

Constructors
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)`

### Method Summary

Methods
`protected Serializable` `copyData(Serializable data)`
`protected void` `doDelete(Serializable key, BlockMetaData metaData)` Performs deletion of the data belonging to the metadata.
`protected Serializable` `doGet(Serializable key, BlockMetaData metaData)` Performs retrieval of the data belonging to the metadata.
`protected Serializable` `doPut(Serializable key, Serializable data, long timeToLive, long maxIdleTime)` Performs storage of the given data and adds new metadata to the map.
`SimpleCacheStatistics` `getBufferStatistics()`
`boolean` `isCopyOnRead()`
`boolean` `isCopyOnWrite()`
`BufferedSerializableIndexedDiskCache` `setCopyOnRead(boolean copyOnRead)`
`BufferedSerializableIndexedDiskCache` `setCopyOnWrite(boolean copyOnWrite)`

### Methods inherited from class net.dontdrinkandroot.cache.impl.disk.indexed.SerializableIndexedDiskCache

`dataFromBytes, dataToBytes, getDataFileNumAllocatedBlocks, getIndexFileNumAllocatedBlocks`

### Methods inherited from class net.dontdrinkandroot.cache.impl.disk.indexed.AbstractIndexedDiskCache

`buildIndex, close`

### Methods inherited from class net.dontdrinkandroot.cache.impl.AbstractMapBackedCustomTtlCache

`doPut, put, put`

### Methods inherited from class net.dontdrinkandroot.cache.impl.AbstractMapBackedCache

`cleanUp, delete, delete, expunge, get, getEntriesMetaData, getEntriesMetaDataMap, getExpungeStrategy, getMetaData, getStatistics, put, setEntriesMetaDataMap, setExpungeStrategy`

### Methods inherited from class net.dontdrinkandroot.cache.impl.AbstractCache

`getCleanUpLogger, getDefaultMaxIdleTime, getDefaultTtl, getLogger, getName, setDefaultMaxIdleTime, setDefaultTtl`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface net.dontdrinkandroot.cache.Cache

`cleanUp, delete, get, getDefaultMaxIdleTime, getDefaultTtl, getMetaData, getName, getStatistics, put`

### Constructor Detail

#### BufferedSerializableIndexedDiskCache

    public BufferedSerializableIndexedDiskCache(String name,
                                        long defaultTimeToLive,
                                        ExpungeStrategy expungeStrategy,
                                        File baseDir,
                                        ExpungeStrategy bufferExpungeStrategy)
                                         throws IOException

Throws:
  `IOException`

#### BufferedSerializableIndexedDiskCache

    public BufferedSerializableIndexedDiskCache(String name,
                                        long defaultTimeToLive,
                                        long defaultMaxIdleTime,
                                        ExpungeStrategy expungeStrategy,
                                        File baseDir,
                                        ExpungeStrategy bufferExpungeStrategy)
                                         throws IOException

Throws:
  `IOException`

### Method Detail

#### getBufferStatistics

    public SimpleCacheStatistics getBufferStatistics()

#### doGet

    protected Serializable doGet(Serializable key,
                     BlockMetaData metaData)
                          throws CacheException

Description copied from class: `AbstractMapBackedCache`
Performs retrieval of the data belonging to the metadata.

Overrides:
  `doGet` in class `AbstractIndexedDiskCache<Serializable,Serializable>`
Throws:
  `CacheException`

#### doPut

    protected Serializable doPut(Serializable key,
                     Serializable data,
                     long timeToLive,
                     long maxIdleTime)
                          throws CacheException

Description copied from class: `AbstractMapBackedCustomTtlCache`
Performs storage of the given data and adds new metadata to the map.

Overrides:
  `doPut` in class `AbstractIndexedDiskCache<Serializable,Serializable>`
Throws:
  `CacheException`

#### doDelete

    protected void doDelete(Serializable key,
                BlockMetaData metaData)
                     throws CacheException

Description copied from class: `AbstractMapBackedCache`
Performs deletion of the data belonging to the metadata. Removal from the map is done by the superclass.

Overrides:
  `doDelete` in class `AbstractIndexedDiskCache<Serializable,Serializable>`
Throws:
  `CacheException`

#### copyData

    protected Serializable copyData(Serializable data)

#### isCopyOnRead

    public boolean isCopyOnRead()

#### isCopyOnWrite

    public boolean isCopyOnWrite()

#### setCopyOnRead

    public BufferedSerializableIndexedDiskCache setCopyOnRead(boolean copyOnRead)

#### setCopyOnWrite

    public BufferedSerializableIndexedDiskCache setCopyOnWrite(boolean copyOnWrite)