|
|||||||||||
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 uses LinkedHashMap
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
An LRU Map implementation based on 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 |
java.lang.String |
getName()
Returns the cache name. |
int |
getSize()
Returns the current cache size. |
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
CacheException
public void put(Element element)
MemoryStore.SpoolingLinkedHashMap.removeEldestEntry(java.util.Map.Entry)
being called.
put
in interface Store
element
- the element to addpublic void removeAll()
removeAll
in interface Store
public Element get(java.io.Serializable key)
Element
is updated.
get
in interface Store
key
- the cache key
public boolean remove(java.io.Serializable key)
remove
in interface Store
key
- the key, usually a String
public java.lang.Object[] getKeyArray()
public int getSize()
getSize
in interface Store
public Cache getCache()
public int getStatus()
Store.STATUS_ALIVE
or
Store.STATUS_ERROR
getStatus
in interface Store
public int getCacheType()
getCacheType
in interface Store
public java.lang.String getName()
getName
in interface Store
public void dispose()
dispose
in interface Store
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |