net.sf.ehcache.store
public abstract class MemoryStore extends Object implements Store
Version: $Id: MemoryStore.java 191 2006-09-03 22:41:48Z gregluck $
Field Summary | |
---|---|
protected Ehcache | cache
The cache this store is associated with. |
protected DiskStore | diskStore
The DiskStore associated with this MemoryStore. |
protected Map | map
Map where items are stored by key. |
protected Status | status
status. |
Constructor Summary | |
---|---|
protected | MemoryStore(Ehcache cache, DiskStore diskStore)
Constructs things that all MemoryStores have in common.
|
Method Summary | |
---|---|
protected void | clear()
Clears any data structures and places it back to its state when it was first created. |
boolean | containsKey(Object key)
An unsynchronized check to see if a key is in the Store. |
static MemoryStore | create(Ehcache cache, DiskStore diskStore)
A factory method to create a MemoryStore.
|
void | dispose()
Prepares for shutdown. |
protected void | doPut(Element element)
Allow specialised actions over adding the element to the map.
|
protected void | evict(Element element)
Evict the Element .
|
void | flush()
Flush to disk. |
Element | get(Object key)
Gets an item from the cache.
|
Object[] | getKeyArray()
Gets an Array of the keys for all elements in the memory cache.
|
Element | getQuiet(Object key)
Gets an item from the cache, without updating Element statistics.
|
int | getSize()
Returns the current cache size.
|
long | getSizeInBytes()
Measures the size of the memory store by measuring the serialized size of all elements.
|
Status | getStatus()
Gets the status of the MemoryStore. |
protected boolean | isFull()
An algorithm to tell if the MemoryStore is at or beyond its carrying capacity. |
protected void | notifyExpiry(Element element)
Before eviction elements are checked.
|
void | put(Element element)
Puts an item in the cache. |
Element | remove(Object key)
Removes an Element from the store.
|
void | removeAll()
Remove all of the elements from the store. |
protected void | spoolAllToDisk()
Spools all elements to disk, in preparation for shutdown.
|
protected void | spoolToDisk(Element element)
Puts the element in the DiskStore.
|
Parameters: cache diskStore
Parameters: key The Element key
Returns: true if found. If this method return false, it means that an Element with the given key is definitely not in the MemoryStore. If it returns true, there is an Element there. An attempt to get it may return null if the Element has expired.
Parameters: cache diskStore
Returns: an instance of a MemoryStore, configured with the appropriate eviction policy
Parameters: element
Element
.
Evict means that the Element
is:
Element
is spooled to the DiskStore
Element
is removed.
Parameters: element the Element
to be evicted.
Parameters: key the cache key
Returns: the element, or null if there was no match for the key
Returns: An Object[]
Parameters: key the cache key
Returns: the element, or null if there was no match for the key
Returns: The size value
Returns: the size, in bytes
Parameters: element
Parameters: element the element to add
Parameters: key the key of the Element, usually a String
Returns: the Element if one was found, else null
Parameters: element The Element