|
||||||||||
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.indexed.IndexedDiskCache
public class IndexedDiskCache
Disk cache that uses a RandomAccessFile with keys stored in memory. The maximum number of keys stored in memory is configurable. The disk cache tries to recycle spots on disk to limit file expansion.
Nested Class Summary | |
---|---|
class |
IndexedDiskCache.LRUMap
Class for recylcing and lru. |
Field Summary | |
---|---|
protected EDU.oswego.cs.dl.util.concurrent.ReentrantWriterPreferenceReadWriteLock |
storageLock
Use this lock to synchronize reads and writes to the underlying storage mechansism. |
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 | |
---|---|
IndexedDiskCache(IndexedDiskCacheAttributes cattr)
Constructor for the DiskCache object. |
Method Summary | |
---|---|
protected boolean |
checkForDedOverlaps(IndexedDiskElementDescriptor[] sortedDescriptors)
Detects any overlapping elements. |
void |
dump()
For debugging. |
void |
dump(boolean dumpValues)
For debugging. |
AuxiliaryCacheAttributes |
getAuxiliaryCacheAttributes()
This returns the generic attributes for an auxiliary cache. |
protected long |
getBytesFree()
Returns the number of bytes that are free. |
protected long |
getDataFileSize()
This is for debugging and testing. |
protected java.lang.String |
getDiskLocation()
This is used by the event logging. |
java.util.Set |
getGroupKeys(java.lang.String groupName)
Gets the group keys from the disk. |
protected int |
getRecyleBinSize()
Returns the size of the recyclebin in number of elements. |
protected int |
getRecyleCount()
Returns the number of times we have used spots from the recycle bin. |
int |
getSize()
Returns the current cache size. |
IStats |
getStatistics()
Returns info about the disk cache. |
java.lang.String |
getStats()
Gets basic stats for the disk cache. |
protected int |
getTimesOptimized()
This is exposed for testing. |
protected void |
loadKeys()
Loads the keys from the .key file. |
protected void |
optimizeFile()
File optimization is handled by this method. |
void |
processDispose()
Dispose of the disk cache in a background thread. |
protected ICacheElement |
processGet(java.io.Serializable key)
Gets the key, then goes to disk to get the object. |
java.util.Map |
processGetMatching(java.lang.String pattern)
Gets matching items from the cache. |
protected boolean |
processRemove(java.io.Serializable key)
Returns true if the removal was successful; or false if there is nothing to remove. |
void |
processRemoveAll()
Remove all the items from the disk cache by reseting everything. |
protected void |
processUpdate(ICacheElement ce)
Update the disk cache. |
protected void |
saveKeys()
Saves key file to disk. |
Methods inherited from class org.apache.jcs.auxiliary.disk.AbstractDiskCache |
---|
dispose, doDispose, doGet, doGetMatching, doRemove, doRemoveAll, doUpdate, get, getCacheName, getCacheType, getEventLoggingExtraInfo, getMatching, 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 |
Field Detail |
---|
protected EDU.oswego.cs.dl.util.concurrent.ReentrantWriterPreferenceReadWriteLock storageLock
Constructor Detail |
---|
public IndexedDiskCache(IndexedDiskCacheAttributes cattr)
cattr
- Method Detail |
---|
protected void loadKeys() throws java.lang.InterruptedException
java.lang.InterruptedException
protected boolean checkForDedOverlaps(IndexedDiskElementDescriptor[] sortedDescriptors)
The total length of an item is IndexedDisk.RECORD_HEADER + ded.len.
sortedDescriptors
-
protected void saveKeys()
protected void processUpdate(ICacheElement ce)
processUpdate
in class AbstractAuxiliaryCacheEventLogging
ce
- The ICacheElement to put to disk.protected ICacheElement processGet(java.io.Serializable key)
processGet
in class AbstractAuxiliaryCacheEventLogging
key
-
AbstractDiskCache.doGet(java.io.Serializable)
public java.util.Map processGetMatching(java.lang.String pattern)
processGetMatching
in class AbstractAuxiliaryCacheEventLogging
pattern
-
public java.util.Set getGroupKeys(java.lang.String groupName)
getGroupKeys
in interface AuxiliaryCache
getGroupKeys
in class AbstractDiskCache
AuxiliaryCache.getGroupKeys(java.lang.String)
protected boolean processRemove(java.io.Serializable key)
processRemove
in class AbstractAuxiliaryCacheEventLogging
key
-
public void processRemoveAll()
processRemoveAll
in class AbstractAuxiliaryCacheEventLogging
public void processDispose()
TODO make dispose window configurable.
processDispose
in class AbstractAuxiliaryCacheEventLogging
protected void optimizeFile()
public int getSize()
getSize
in interface ICache
getSize
in class AbstractDiskCache
ICache.getSize()
protected int getRecyleBinSize()
protected int getRecyleCount()
protected long getBytesFree()
protected long getDataFileSize() throws java.io.IOException
java.io.IOException
public void dump()
public void dump(boolean dumpValues)
dumpValues
- A boolean indicating if values should be dumped.public AuxiliaryCacheAttributes getAuxiliaryCacheAttributes()
AuxiliaryCache
public java.lang.String getStats()
getStats
in interface ICache
getStats
in class AbstractDiskCache
public IStats getStatistics()
(non-Javadoc)
getStatistics
in interface AuxiliaryCache
getStatistics
in class AbstractDiskCache
AuxiliaryCache.getStatistics()
protected int getTimesOptimized()
protected java.lang.String getDiskLocation()
getDiskLocation
in class AbstractDiskCache
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |