|
ehcache | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectnet.sf.ehcache.store.MemoryStore
An implementation of a MemoryStore.
This usesLinkedHashMap as its backing map. It uses the LinkedHashMap LRU
feature. LRU for this implementation means least recently accessed.
| Nested Class Summary | |
class |
MemoryStore.SpoolingLinkedHashMap
An extension of LinkedHashMap which overrides MemoryStore.SpoolingLinkedHashMap.removeEldestEntry(java.util.Map.Entry)
to persist cache entries to the auxiliary cache before they are removed. |
class |
MemoryStore.SpoolingLRUMap
A Map implementation that delegates to Apache Commons LRUMap. |
| Field Summary |
| Fields inherited from interface net.sf.ehcache.store.Store |
CACHE_HUB, DISK_CACHE, STATUS_ALIVE, STATUS_DISPOSED, STATUS_ERROR, STATUS_UNINITIALISED |
| Constructor Summary | |
MemoryStore(Cache cache,
DiskStore diskStore)
Constructor for the MemoryStore object The backing LinkedHashMap is created with LRU by access order. |
|
| Method Summary | |
void |
dispose()
Prepares for shutdown. |
Element |
get(java.io.Serializable key)
Gets an item from the cache The last access time in Element is updated. |
Cache |
getCache()
Gets the cache that the MemoryStore is used by |
int |
getCacheType()
Returns the cache type. |
java.lang.Object[] |
getKeyArray()
Gets an Array of the keys for all elements in the memory cache Does not check for expired entries |
java.lang.String |
getName()
Returns the cache name. |
Element |
getQuiet(java.io.Serializable key)
Gets an item from the cache, without updating Element statistics The last access time in Element is updated. |
int |
getSize()
Returns the current cache size. |
long |
getSizeInBytes()
Measures the size of the memory store by measuring the serialized size of all elements. |
int |
getStatus()
Gets the status of the MemoryStore. |
java.util.Map |
loadMapInstance()
Tries to load a LinkedHashMap (JDK1.4) and then
tries to load an LRUMap. |
void |
put(Element element)
Puts an item in the cache. |
boolean |
remove(java.io.Serializable key)
Removes an item from the cache. |
void |
removeAll()
Remove all of the elements from the cache. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public MemoryStore(Cache cache,
DiskStore diskStore)
LinkedHashMap is created with LRU by access order.
| Method Detail |
public java.util.Map loadMapInstance()
throws CacheException
LinkedHashMap (JDK1.4) and then
tries to load an LRUMap.
This way applications running JDK1.4 do not have a dependency
on Apache commons-collections.
LinkedHashMap or
CacheExceptionpublic void put(Element element)
MemoryStore.SpoolingLinkedHashMap.removeEldestEntry(java.util.Map.Entry) being called.
put in interface Storeelement - the element to addpublic void removeAll()
removeAll in interface Storepublic Element get(java.io.Serializable key)
Element is updated.
get in interface Storekey - the cache key
public Element getQuiet(java.io.Serializable key)
Element is updated.
key - the cache key
public boolean remove(java.io.Serializable key)
remove in interface Storekey - the key, usually a String
public java.lang.Object[] getKeyArray()
public int getSize()
getSize in interface Storepublic Cache getCache()
public int getStatus()
Store.STATUS_ALIVE or
Store.STATUS_ERROR
getStatus in interface Storepublic int getCacheType()
getCacheType in interface Storepublic java.lang.String getName()
getName in interface Storepublic void dispose()
dispose in interface Store
public long getSizeInBytes()
throws CacheException
CacheException
|
ehcache | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||