|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.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 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 |
doDispose()
Dispose of the disk cache in a background thread. |
protected ICacheElement |
doGet(java.io.Serializable key)
Get a value from the persistent store. |
boolean |
doRemove(java.io.Serializable key)
Returns true if the removal was succesful; or false if there is nothing to remove. |
void |
doRemoveAll()
Remove all the items from the disk cache by reseting everything. |
void |
doUpdate(ICacheElement ce)
Update the disk cache. |
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. |
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. |
protected void |
saveKeys()
Saves key file to disk. |
Methods inherited from class org.apache.jcs.auxiliary.disk.AbstractDiskCache |
---|
dispose, get, getCacheName, getCacheType, getStatus, remove, removeAll, update |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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()
public void doUpdate(ICacheElement ce)
doUpdate
in class AbstractDiskCache
ce
- The ICacheElement to put to disk.protected ICacheElement doGet(java.io.Serializable key)
AbstractDiskCache
doGet
in class AbstractDiskCache
key
-
AbstractDiskCache.doGet(java.io.Serializable)
public java.util.Set getGroupKeys(java.lang.String groupName)
getGroupKeys
in interface AuxiliaryCache
getGroupKeys
in class AbstractDiskCache
AuxiliaryCache.getGroupKeys(java.lang.String)
public boolean doRemove(java.io.Serializable key)
doRemove
in class AbstractDiskCache
key
-
public void doRemoveAll()
doRemoveAll
in class AbstractDiskCache
public void doDispose()
doDispose
in class AbstractDiskCache
protected void optimizeFile()
public int getSize()
getSize
in interface AuxiliaryCache
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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |