net.dontdrinkandroot.cache.impl.disk.file
Class FileCache
java.lang.Object
net.dontdrinkandroot.cache.impl.AbstractCache<K,V>
net.dontdrinkandroot.cache.impl.AbstractMapBackedCache<Md5,File,SimpleMetaData>
net.dontdrinkandroot.cache.impl.disk.file.FileCache
- All Implemented Interfaces:
- Cache<Md5,File>
public class FileCache
- extends AbstractMapBackedCache<Md5,File,SimpleMetaData>
- Author:
- Philip W. Sorst
| Methods inherited from class net.dontdrinkandroot.cache.impl.AbstractMapBackedCache |
cleanUp, delete, delete, expunge, get, getEntriesMetaData, getEntriesMetaDataMap, getExpungeStrategy, getMetaData, getStatistics, getWithErrors, put, putWithErrors, setEntriesMetaDataMap, setExpungeStrategy |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MD5_PATTERN
public static Pattern MD5_PATTERN
FileCache
public FileCache(String name,
long defaultTimeToLive,
long defaultMaxIdleTime,
ExpungeStrategy expungeStrategy,
File baseDir,
int directoryDepth)
throws IOException,
CacheException
- Throws:
IOException
CacheException
doDelete
protected void doDelete(Md5 key,
SimpleMetaData 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.
- Specified by:
doDelete in class AbstractMapBackedCache<Md5,File,SimpleMetaData>
- Throws:
CacheException
doGet
protected File doGet(Md5 key,
SimpleMetaData metaData)
throws CacheException
- Description copied from class:
AbstractMapBackedCache
- Performs retrieval of the data belonging to the metadata.
- Specified by:
doGet in class AbstractMapBackedCache<Md5,File,SimpleMetaData>
- Throws:
CacheException
doPut
protected File doPut(Md5 md5,
File data)
throws CacheException
- Description copied from class:
AbstractMapBackedCache
- Performs storage of the given data and adds new metadata to the map.
- Specified by:
doPut in class AbstractMapBackedCache<Md5,File,SimpleMetaData>
- Throws:
CacheException
getBaseDir
public final File getBaseDir()
createDirStructure
protected void createDirStructure(File dir,
int directoryDepth)
throws IOException
- Recursively creates directories 0x0 - 0xF until the desired depth is reached.
- Parameters:
dir - The base directory.directoryDepth - The level of nesting [0,...].
- Throws:
IOException
getFileName
protected String getFileName(Md5 md5)
readInitialMap
protected Map<Md5,SimpleMetaData> readInitialMap()
throws CacheException
- Throws:
CacheException
Copyright © 2013 dontdrinkandroot. All Rights Reserved.