|
ehcache | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.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. The DiskStore, as of ehcache-1.2.4, supports eviction using an LFU policy, if a maximum disk store size is set. LFU uses statistics held at the Element level which survive moving between maps in the MemoryStore and DiskStores.
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(Ehcache cache,
java.lang.String diskPath)
Creates a disk store. |
Method Summary | |
---|---|
boolean |
backedUp()
In some circumstances data can be written so quickly to the spool that the VM runs out of memory while waiting for the spooling to disk. |
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 |
expireElements()
Removes expired elements. |
void |
flush()
Flush the spool if persistent, so we don't lose any data. |
static java.lang.String |
generateUniqueDirectory()
Generates a unique directory name for use in automatically creating a diskStorePath where there is a conflict. |
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 |
isSpoolThreadAlive()
The spool thread is started when the disk store is created. |
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(Ehcache 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
getQuiet
in interface Store
public final java.lang.Object[] getKeyArray()
getKeyArray
in interface Store
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 boolean backedUp()
backedUp
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
flush
in interface Store
java.io.IOException
public void expireElements()
expireElements
in interface Store
public final java.lang.String toString()
String
representation of the DiskStore
toString
in class java.lang.Object
public static java.lang.String generateUniqueDirectory()
AUTO_DISK_PATH_DIRECTORY_PREFIX
followed by "_" followed by the current
time as a long e.g. ehcache_auto_created_1149389837006public 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 isSpoolThreadAlive()
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 |