|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jcs.auxiliary.AbstractAuxiliaryCache
org.apache.jcs.auxiliary.AbstractAuxiliaryCacheEventLogging
org.apache.jcs.auxiliary.disk.AbstractDiskCache
org.apache.jcs.auxiliary.disk.file.FileDiskCache
public class FileDiskCache
This disk cache writes each item to a separate file. This is for regions with very few items, perhaps big ones.
This is a fairly simple implementation. All the disk writing is handled right here. It's not clear that anything more complicated is needed.
Field Summary |
---|
Fields inherited from class org.apache.jcs.auxiliary.disk.AbstractDiskCache |
---|
alive, cacheEventQueue, cacheName, purgatory, purgHits |
Fields inherited from class org.apache.jcs.auxiliary.AbstractAuxiliaryCache |
---|
cacheEventLogger, elementSerializer, keyMatcher |
Fields inherited from interface org.apache.jcs.engine.behavior.ICacheType |
---|
CACHE_HUB, DISK_CACHE, LATERAL_CACHE, REMOTE_CACHE |
Constructor Summary | |
---|---|
FileDiskCache(FileDiskCacheAttributes cacheAttributes)
Constructor for the DiskCache object. |
|
FileDiskCache(FileDiskCacheAttributes cattr,
IElementSerializer elementSerializer)
Constructor for the DiskCache object. |
Method Summary | |
---|---|
protected File |
file(Serializable key)
Creates the file for a key. |
AuxiliaryCacheAttributes |
getAuxiliaryCacheAttributes()
This returns the generic attributes for an auxiliary cache. |
protected File |
getDirectory()
|
protected String |
getDiskLocation()
This is used by the event logging. |
Set |
getGroupKeys(String groupName)
The keys in a group. |
int |
getSize()
Size cannot be determined without knowledge of the cache implementation, so subclasses will need to implement this method. |
protected void |
processDispose()
Sets alive to false. |
protected ICacheElement |
processGet(Serializable key)
Looks for a file matching the key. |
protected Map |
processGetMatching(String pattern)
Implementation of getMatching. |
protected boolean |
processRemove(Serializable key)
Removes the file. |
protected void |
processRemoveAll()
Remove all the files in the directory. |
protected void |
processUpdate(ICacheElement element)
We create a temp file with the new contents, remove the old if it exists, and then rename the temp. |
protected void |
setDirectory(File directory)
|
Methods inherited from class org.apache.jcs.auxiliary.disk.AbstractDiskCache |
---|
dispose, doDispose, doGet, doGetMatching, doRemove, doRemoveAll, doUpdate, get, getCacheName, getCacheType, getEventLoggingExtraInfo, getMatching, getStatistics, getStats, getStatus, processGetMultiple, remove, removeAll, update |
Methods inherited from class org.apache.jcs.auxiliary.AbstractAuxiliaryCacheEventLogging |
---|
disposeWithEventLogging, getMatchingWithEventLogging, getMultiple, getMultipleWithEventLogging, getWithEventLogging, removeAllWithEventLogging, removeWithEventLogging, updateWithEventLogging |
Methods inherited from class org.apache.jcs.auxiliary.AbstractAuxiliaryCache |
---|
createICacheEvent, createICacheEvent, getCacheEventLogger, getElementSerializer, getKeyMatcher, logApplicationEvent, logError, logICacheEvent, setCacheEventLogger, setElementSerializer, setKeyMatcher |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.jcs.auxiliary.AuxiliaryCache |
---|
setCacheEventLogger, setElementSerializer |
Methods inherited from interface org.apache.jcs.engine.behavior.ICache |
---|
getMultiple, setKeyMatcher |
Constructor Detail |
---|
public FileDiskCache(FileDiskCacheAttributes cacheAttributes)
cacheAttributes
- public FileDiskCache(FileDiskCacheAttributes cattr, IElementSerializer elementSerializer)
cattr
- elementSerializer
- used if supplied, the super's super will not set a nullMethod Detail |
---|
protected File file(Serializable key)
Protected for testing.
key
-
public Set getGroupKeys(String groupName)
AbstractDiskCache
(non-Javadoc)
getGroupKeys
in interface AuxiliaryCache
getGroupKeys
in class AbstractDiskCache
groupName
-
AuxiliaryCache.getGroupKeys(java.lang.String)
public int getSize()
AbstractDiskCache
getSize
in interface ICache
getSize
in class AbstractDiskCache
ICache.getSize()
public AuxiliaryCacheAttributes getAuxiliaryCacheAttributes()
AuxiliaryCache
protected String getDiskLocation()
AbstractDiskCache
getDiskLocation
in class AbstractDiskCache
protected void processDispose() throws IOException
processDispose
in class AbstractAuxiliaryCacheEventLogging
IOException
protected ICacheElement processGet(Serializable key) throws IOException
processGet
in class AbstractAuxiliaryCacheEventLogging
key
-
IOException
protected Map processGetMatching(String pattern) throws IOException
AbstractAuxiliaryCacheEventLogging
processGetMatching
in class AbstractAuxiliaryCacheEventLogging
pattern
-
IOException
protected boolean processRemove(Serializable key) throws IOException
processRemove
in class AbstractAuxiliaryCacheEventLogging
key
-
IOException
protected void processRemoveAll() throws IOException
Assumes that this is the only region in the directory. We could add a region prefix to the files and only delete those, but the region should create a directory.
processRemoveAll
in class AbstractAuxiliaryCacheEventLogging
IOException
protected void processUpdate(ICacheElement element) throws IOException
processUpdate
in class AbstractAuxiliaryCacheEventLogging
element
-
IOException
protected void setDirectory(File directory)
directory
- the directory to setprotected File getDirectory()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |