net.sf.ehcache
public interface Ehcache extends Cloneable
Version: $Id: Ehcache.java 191 2006-09-03 22:41:48Z gregluck $
Method Summary | |
---|---|
void | bootstrap()
Bootstrap command. |
long | calculateInMemorySize()
Gets the size of the memory store for this cache
Warning: This method can be very expensive to run. |
void | clearStatistics()
Resets statistics counters back to 0. |
Object | clone()
Clones a cache. |
void | dispose()
Flushes all cache items from memory to auxilliary caches and close the auxilliary caches.
|
void | evictExpiredElements()
Causes all elements stored in the Cache to be synchronously checked for expiry, and if expired, evicted. |
void | flush()
Flushes all cache items from memory to the disk store, and from the DiskStore to disk.
|
Element | get(Serializable key)
Gets an element from the cache. |
Element | get(Object key)
Gets an element from the cache. |
BootstrapCacheLoader | getBootstrapCacheLoader()
Accessor for the BootstrapCacheLoader associated with this cache. |
RegisteredEventListeners | getCacheEventNotificationService()
Use this to access the service in order to register and unregister listeners
|
CacheManager | getCacheManager()
Gets the CacheManager managing this cache. |
long | getDiskExpiryThreadIntervalSeconds() |
int | getDiskStoreHitCount()
Number of times a requested item was found in the Disk Store. |
int | getDiskStoreSize()
Returns the number of elements in the disk store.
|
String | getGuid()
The GUID for this cache instance can be used to determine whether two cache instance references
are pointing to the same cache.
|
int | getHitCount()
The number of times a requested item was found in the cache.
|
List | getKeys()
Returns a list of all elements in the cache, whether or not they are expired.
|
List | getKeysNoDuplicateCheck()
Returns a list of all elements in the cache, whether or not they are expired.
|
List | getKeysWithExpiryCheck()
Returns a list of all elements in the cache. |
int | getMaxElementsInMemory()
Gets the maximum number of elements to hold in memory. |
MemoryStoreEvictionPolicy | getMemoryStoreEvictionPolicy()
The policy used to evict elements from the MemoryStore.
|
int | getMemoryStoreHitCount()
Number of times a requested item was found in the Memory Store.
|
long | getMemoryStoreSize()
Returns the number of elements in the memory store.
|
int | getMissCountExpired()
Number of times a requested element was found but was expired. |
int | getMissCountNotFound()
Number of times a requested element was not found in the cache. |
String | getName()
Gets the cache name. |
Element | getQuiet(Serializable key)
Gets an element from the cache, without updating Element statistics. |
Element | getQuiet(Object key)
Gets an element from the cache, without updating Element statistics. |
int | getSize()
Gets the size of the cache. |
Statistics | getStatistics()
Gets an immutable Statistics object representing the Cache statistics at the time. |
int | getStatisticsAccuracy()
Accurately measuring statistics can be expensive. |
Status | getStatus()
Gets the status attribute of the Cache.
|
long | getTimeToIdleSeconds()
Gets timeToIdleSeconds. |
long | getTimeToLiveSeconds()
Gets timeToLiveSeconds. |
void | initialise()
Newly created caches do not have a MemoryStore or a DiskStore.
|
boolean | isDiskPersistent() |
boolean | isElementInMemory(Serializable key)
Whether an Element is stored in the cache in Memory, indicating a very low cost of retrieval.
|
boolean | isElementInMemory(Object key)
Whether an Element is stored in the cache in Memory, indicating a very low cost of retrieval.
|
boolean | isElementOnDisk(Serializable key)
Whether an Element is stored in the cache on Disk, indicating a higher cost of retrieval.
|
boolean | isElementOnDisk(Object key)
Whether an Element is stored in the cache on Disk, indicating a higher cost of retrieval.
|
boolean | isEternal()
Are elements eternal. |
boolean | isExpired(Element element)
Checks whether this cache element has expired.
|
boolean | isKeyInCache(Object key)
An inexpensive check to see if the key exists in the cache.
|
boolean | isOverflowToDisk()
Does the overflow go to disk. |
boolean | isValueInCache(Object value)
An extremely expensive check to see if the value exists in the cache.
|
void | put(Element element)
Put an element in the cache.
|
void | put(Element element, boolean doNotNotifyCacheReplicators)
Put an element in the cache.
|
void | putQuiet(Element element)
Put an element in the cache, without updating statistics, or updating listeners. |
boolean | remove(Serializable key)
Removes an Element from the Cache. |
boolean | remove(Object key)
Removes an Element from the Cache. |
boolean | remove(Serializable key, boolean doNotNotifyCacheReplicators)
Removes an Element from the Cache. |
boolean | remove(Object key, boolean doNotNotifyCacheReplicators)
Removes an Element from the Cache. |
void | removeAll()
Removes all cached items.
|
void | removeAll(boolean doNotNotifyCacheReplicators)
Removes all cached items. |
boolean | removeQuiet(Serializable key)
Removes an Element from the Cache, without notifying listeners. |
boolean | removeQuiet(Object key)
Removes an Element from the Cache, without notifying listeners. |
void | setBootstrapCacheLoader(BootstrapCacheLoader bootstrapCacheLoader)
Sets the bootstrap cache loader.
|
void | setCacheManager(CacheManager cacheManager)
Sets the CacheManager
|
void | setDiskStorePath(String diskStorePath)
DiskStore paths can conflict between CacheManager instances. |
void | setName(String name)
Sets the cache name which will name.
|
void | setStatisticsAccuracy(int statisticsAccuracy)
Sets the statistics accuracy.
|
String | toString()
Returns a String representation of Cache. |
Returns: the approximate size of the memory store in bytes
Throws: IllegalStateException
Returns: an object of type Cache
Throws: CloneNotSupportedException
Throws: IllegalStateException if the cache is not STATUS_ALIVE
Throws: IllegalStateException if the cache is not STATUS_ALIVE
Parameters: key a serializable value
Returns: the element, or null, if it does not exist.
Throws: IllegalStateException if the cache is not STATUS_ALIVE
See Also: Ehcache
Parameters: key an Object value
Returns: the element, or null, if it does not exist.
Throws: IllegalStateException if the cache is not STATUS_ALIVE
Since: 1.2
See Also: Ehcache
Returns: the BootstrapCacheLoader to use
Returns: the RegisteredEventListeners instance for this cache.
Returns: the manager or null if there is none
Returns: the interval between runs of the expiry thread, where it checks the disk store for expired elements. It is not the the timeToLiveSeconds.
Returns: the number of elements in the disk store.
Throws: IllegalStateException if the cache is not STATUS_ALIVE
Returns: the globally unique identifier for this cache instance. This is guaranteed to be unique.
Since: 1.2
Returns: the number of times a requested item was found in the cache
Returns: a list of Object keys
Throws: IllegalStateException if the cache is not STATUS_ALIVE
Returns: a list of Object keys
Throws: IllegalStateException if the cache is not STATUS_ALIVE
Returns: a list of Object keys
Throws: IllegalStateException if the cache is not STATUS_ALIVE
Since: 1.2
Returns: Number of times a requested item was found in the Memory Store.
Returns: the number of elements in the memory store
Throws: IllegalStateException if the cache is not STATUS_ALIVE
Parameters: key a serializable value
Returns: the element, or null, if it does not exist.
Throws: IllegalStateException if the cache is not STATUS_ALIVE
See Also: Ehcache
Parameters: key a serializable value
Returns: the element, or null, if it does not exist.
Throws: IllegalStateException if the cache is not STATUS_ALIVE
Since: 1.2
See Also: Ehcache
Returns: The size value
Throws: IllegalStateException if the cache is not STATUS_ALIVE
Returns: the number of elements in the ehcache, with a varying degree of accuracy, depending on accuracy setting.
Throws: IllegalStateException if the cache is not STATUS_ALIVE
Returns: one of STATISTICS_ACCURACY_BEST_EFFORT, STATISTICS_ACCURACY_GUARANTEED, STATISTICS_ACCURACY_NONE
Returns: The status value from the Status enum class
Returns: true if the cache overflows to disk and the disk is persistent between restarts
Returns: true if an element matching the key is found in memory
Returns: true if an element matching the key is found in memory
Since: 1.2
Returns: true if an element matching the key is found in the diskStore
Returns: true if an element matching the key is found in the diskStore
Since: 1.2
Returns: true if it has expired
Throws: IllegalStateException if the cache is not STATUS_ALIVE NullPointerException if the element is null
Parameters: key the key to check for
Returns: true if an Element matching the key is found in the cache. No assertions are made about the state of the Element.
Parameters: value to check for
Returns: true if an Element matching the key is found in the cache. No assertions are made about the state of the Element.
Parameters: element An object. If Serializable it can fully participate in replication and the DiskStore.
Throws: IllegalStateException if the cache is not STATUS_ALIVE IllegalArgumentException if the element is null CacheException
Parameters: element An object. If Serializable it can fully participate in replication and the DiskStore. doNotNotifyCacheReplicators whether the put is coming from a doNotNotifyCacheReplicators cache peer, in which case this put should not initiate a further notification to doNotNotifyCacheReplicators cache peers
Throws: IllegalStateException if the cache is not STATUS_ALIVE IllegalArgumentException if the element is null
Parameters: element An object. If Serializable it can fully participate in replication and the DiskStore.
Throws: IllegalStateException if the cache is not STATUS_ALIVE IllegalArgumentException if the element is null
Parameters: key
Returns: true if the element was removed, false if it was not found in the cache
Throws: IllegalStateException if the cache is not STATUS_ALIVE
Parameters: key
Returns: true if the element was removed, false if it was not found in the cache
Throws: IllegalStateException if the cache is not STATUS_ALIVE
Since: 1.2
Parameters: key doNotNotifyCacheReplicators whether the put is coming from a doNotNotifyCacheReplicators cache peer, in which case this put should not initiate a further notification to doNotNotifyCacheReplicators cache peers
Returns: true if the element was removed, false if it was not found in the cache
Throws: IllegalStateException if the cache is not STATUS_ALIVE
UNKNOWN: SameParameterValue
Parameters: key doNotNotifyCacheReplicators whether the put is coming from a doNotNotifyCacheReplicators cache peer, in which case this put should not initiate a further notification to doNotNotifyCacheReplicators cache peers
Returns: true if the element was removed, false if it was not found in the cache
Throws: IllegalStateException if the cache is not STATUS_ALIVE
Throws: IllegalStateException if the cache is not STATUS_ALIVE
Parameters: doNotNotifyCacheReplicators whether the put is coming from a doNotNotifyCacheReplicators cache peer, in which case this put should not initiate a further notification to doNotNotifyCacheReplicators cache peers
Throws: IllegalStateException if the cache is not STATUS_ALIVE
Parameters: key
Returns: true if the element was removed, false if it was not found in the cache
Throws: IllegalStateException if the cache is not STATUS_ALIVE
Parameters: key
Returns: true if the element was removed, false if it was not found in the cache
Throws: IllegalStateException if the cache is not STATUS_ALIVE
Since: 1.2
Parameters: bootstrapCacheLoader the loader to be used
Throws: CacheException if this method is called after the cache is initialized
Parameters: cacheManager the CacheManager for this cache to use.
Parameters: diskStorePath the new path to be used.
Throws: CacheException if this method is called after the cache is initialized
Parameters: name the name of the cache. Should not be null.
Parameters: statisticsAccuracy one of STATISTICS_ACCURACY_BEST_EFFORT, STATISTICS_ACCURACY_GUARANTEED, STATISTICS_ACCURACY_NONE