public class IndexedDiskCache extends AbstractDiskCache
| Modifier and Type | Class and Description |
|---|---|
class |
IndexedDiskCache.LRUMap
Class for recylcing and lru.
|
| Modifier and Type | Field and Description |
|---|---|
protected EDU.oswego.cs.dl.util.concurrent.ReentrantWriterPreferenceReadWriteLock |
storageLock
Use this lock to synchronize reads and writes to the underlying storage mechansism.
|
alive, cacheEventQueue, cacheName, purgatory, purgHitscacheEventLogger, elementSerializer, keyMatcherCACHE_HUB, DISK_CACHE, LATERAL_CACHE, REMOTE_CACHE| Constructor and Description |
|---|
IndexedDiskCache(IndexedDiskCacheAttributes cattr)
Constructor for the DiskCache object.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
dispose, doDispose, doGet, doGetMatching, doRemove, doRemoveAll, doUpdate, get, getCacheName, getCacheType, getEventLoggingExtraInfo, getMatching, getStatus, processGetMultiple, remove, removeAll, updatedisposeWithEventLogging, getMatchingWithEventLogging, getMultiple, getMultipleWithEventLogging, getWithEventLogging, removeAllWithEventLogging, removeWithEventLogging, updateWithEventLoggingcreateICacheEvent, createICacheEvent, getCacheEventLogger, getElementSerializer, getKeyMatcher, logApplicationEvent, logError, logICacheEvent, setCacheEventLogger, setElementSerializer, setKeyMatcherclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsetCacheEventLogger, setElementSerializergetMultiple, setKeyMatcherprotected EDU.oswego.cs.dl.util.concurrent.ReentrantWriterPreferenceReadWriteLock storageLock
public IndexedDiskCache(IndexedDiskCacheAttributes cattr)
cattr - protected void loadKeys()
throws java.lang.InterruptedException
java.lang.InterruptedExceptionprotected 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 AbstractAuxiliaryCacheEventLoggingce - The ICacheElement to put to disk.protected ICacheElement processGet(java.io.Serializable key)
processGet in class AbstractAuxiliaryCacheEventLoggingkey - AbstractDiskCache.doGet(java.io.Serializable)public java.util.Map processGetMatching(java.lang.String pattern)
processGetMatching in class AbstractAuxiliaryCacheEventLoggingpattern - public java.util.Set getGroupKeys(java.lang.String groupName)
getGroupKeys in interface AuxiliaryCachegetGroupKeys in class AbstractDiskCacheAuxiliaryCache.getGroupKeys(java.lang.String)protected boolean processRemove(java.io.Serializable key)
processRemove in class AbstractAuxiliaryCacheEventLoggingkey - public void processRemoveAll()
processRemoveAll in class AbstractAuxiliaryCacheEventLoggingpublic void processDispose()
TODO make dispose window configurable.
processDispose in class AbstractAuxiliaryCacheEventLoggingprotected void optimizeFile()
public int getSize()
getSize in interface ICachegetSize in class AbstractDiskCacheICache.getSize()protected int getRecyleBinSize()
protected int getRecyleCount()
protected long getBytesFree()
protected long getDataFileSize()
throws java.io.IOException
java.io.IOExceptionpublic void dump()
public void dump(boolean dumpValues)
dumpValues - A boolean indicating if values should be dumped.public AuxiliaryCacheAttributes getAuxiliaryCacheAttributes()
AuxiliaryCachepublic java.lang.String getStats()
getStats in interface ICachegetStats in class AbstractDiskCachepublic IStats getStatistics()
(non-Javadoc)
getStatistics in interface AuxiliaryCachegetStatistics in class AbstractDiskCacheAuxiliaryCache.getStatistics()protected int getTimesOptimized()
protected java.lang.String getDiskLocation()
getDiskLocation in class AbstractDiskCacheCopyright © 2002-2013 Apache Software Foundation. All Rights Reserved.