|
ehcache | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.ehcache.store.DiskStore
public class DiskStore
A disk store implementation.
As of ehcache-1.2 (v1.41 of this file) DiskStore has been changed to a mix of finer grained locking using synchronized collections and synchronizing on the whole instance, as was the case with earlier versions.
Nested Class Summary | |
---|---|
(package private) class |
DiskStore.MemoryEfficientByteArrayOutputStream
This class is designed to minimse the number of System.arraycopy(); methods required to complete. |
Field Summary | |
---|---|
static java.lang.String |
AUTO_DISK_PATH_DIRECTORY_PREFIX
If the CacheManager needs to resolve a conflict with the disk path, it will create a subdirectory in the given disk path with this prefix followed by a number. |
Constructor Summary | |
---|---|
DiskStore(Cache cache,
java.lang.String diskPath)
Creates a disk store. |
Method Summary | |
---|---|
float |
calculateDataFileSparseness()
The design of the layout on the data file means that there will be small gaps created when DiskElements are reused. |
boolean |
containsKey(java.lang.Object key)
An unsynchronized and very low cost check to see if a key is in the Store. |
void |
dispose()
Shuts down the disk store in preparation for cache shutdown If a VM crash happens, the shutdown hook will not run. |
void |
flush()
Flush the spool if persistent, so we don't lose any data. |
Element |
get(java.lang.Object key)
Gets an Element from the Disk Store. |
java.lang.String |
getDataFileName()
|
java.lang.String |
getDataFilePath()
|
long |
getDataFileSize()
|
java.lang.String |
getIndexFileName()
|
long |
getIndexFileSize()
|
java.lang.Object[] |
getKeyArray()
Gets an Array of the keys for all elements in the disk store. |
Element |
getQuiet(java.lang.Object key)
Gets an Element from the Disk Store, without updating statistics |
int |
getSize()
Returns the current store size. |
Status |
getStatus()
Returns the store status. |
long |
getTotalFileSize()
|
long |
getUsedDataSize()
When elements are deleted, spaces are left in the file. |
boolean |
isExpiryThreadAlive()
The expiry thread is started provided the cache is not eternal If started it will continue to run until the dispose() method is called,
at which time it should be interrupted and then die. |
boolean |
isSpoolEmpty()
Whether there are any elements waiting to be spooled to disk. |
void |
put(Element element)
Puts an element into the disk store. |
Element |
remove(java.lang.Object key)
Removes an item from the disk store. |
void |
removeAll()
Remove all of the elements from the store. |
java.lang.String |
toString()
Returns a String representation of the DiskStore |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String AUTO_DISK_PATH_DIRECTORY_PREFIX
Constructor Detail |
---|
public DiskStore(Cache cache, java.lang.String diskPath)
cache
- the Cache
that the store is part ofdiskPath
- the directory in which to create data and index filesMethod Detail |
---|
public final Element get(java.lang.Object key)
Element
from the Disk Store.
get
in interface Store
public final boolean containsKey(java.lang.Object key)
containsKey
in interface Store
key
- The Element key
public final Element getQuiet(java.lang.Object key)
Element
from the Disk Store, without updating statistics
public final java.lang.Object[] getKeyArray()
Serializable
keyspublic final int getSize()
getSize
in interface Store
public final Status getStatus()
getStatus
in interface Store
public final void put(Element element)
put
in interface Store
public final Element remove(java.lang.Object key)
remove
in interface Store
public final void removeAll()
CacheEventListener
s they are notified of the expiry or removal
of the Element
as each is removed.
removeAll
in interface Store
public final void dispose()
dispose
in interface Store
public final void flush() throws java.io.IOException
java.io.IOException
public final boolean isSpoolEmpty()
public final java.lang.String toString()
String
representation of the DiskStore
toString
in class java.lang.Object
public final long getTotalFileSize()
public final long getDataFileSize()
public final float calculateDataFileSparseness()
public final long getUsedDataSize()
getDataFileSize()
as a measure of fragmentation.
public final long getIndexFileSize()
public final java.lang.String getDataFileName()
public final java.lang.String getDataFilePath()
public final java.lang.String getIndexFileName()
public final boolean isExpiryThreadAlive()
dispose()
method is called,
at which time it should be interrupted and then die.
|
ehcache | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |