|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jcs.engine.memory.AbstractMemoryCache
org.apache.jcs.engine.memory.lru.LRUMemoryCache
A fast reference management system. The least recently used items move to the end of the list and get spooled to disk if the cache hub is configured to use a disk cache. Most of the cache bottelnecks are in IO. There are no io bottlenecks here, it's all about processing power. Even though there are only a few adjustments necessary to maintain the double linked list, we might want to find a more efficient memory manager for large cache regions. The LRUMemoryCache is most efficeint when the first element is selected. The smaller the region, the better the chance that this will be the case. < .04 ms per put, p3 866, 1/10 of that per get
Nested Class Summary | |
class |
LRUMemoryCache.IteratorWrapper
|
class |
LRUMemoryCache.MapEntryWrapper
|
Field Summary | |
private MemoryElementDescriptor |
first
|
private MemoryElementDescriptor |
last
|
private static org.apache.commons.logging.Log |
log
|
Fields inherited from class org.apache.jcs.engine.memory.AbstractMemoryCache |
attr, cache, cacheName, cattr, chunkSize, map, status |
Constructor Summary | |
LRUMemoryCache()
|
Method Summary | |
private void |
addFirst(ICacheElement ce)
Adds a new node to the start of the link list. |
private void |
addLast(CacheElement ce)
Adds a new node to the end of the link list. |
void |
dumpCacheEntries()
Dump the cache entries from first to list for debugging. |
private int |
dumpCacheSize()
|
void |
dumpMap()
Dump the cache map for debugging. |
ICacheElement |
get(java.io.Serializable key)
Get an item from the cache |
java.util.Iterator |
getIterator()
Gets the iterator attribute of the LRUMemoryCache object |
java.lang.Object[] |
getKeyArray()
Get an Array of the keys for all elements in the memory cache |
ICacheElement |
getQuiet(java.io.Serializable key)
Get an item from the cache without affecting its last access time or position. |
void |
initialize(CompositeCache hub)
For post reflection creation initialization |
void |
makeFirst(ICacheElement ce)
Moves an existing node to the start of the link list. |
void |
makeFirst(MemoryElementDescriptor me)
Moves an existing node to the start of the link list. |
boolean |
remove(java.io.Serializable key)
Removes an item from the cache. |
void |
removeAll()
Remove all of the elements from both the Map and the linked list implementation. |
private void |
removeNode(MemoryElementDescriptor me)
Removes the specified node from the link list. |
void |
update(ICacheElement ce)
Puts an item to the cache. |
private void |
verifyCache()
|
private void |
verifyCache(java.io.Serializable key)
|
Methods inherited from class org.apache.jcs.engine.memory.AbstractMemoryCache |
dispose, getCacheAttributes, getCacheName, getCompositeCache, getGroupKeys, getSize, getStats, getStatus, setCacheAttributes, waterfal |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final org.apache.commons.logging.Log log
private MemoryElementDescriptor first
private MemoryElementDescriptor last
Constructor Detail |
public LRUMemoryCache()
Method Detail |
public void initialize(CompositeCache hub)
initialize
in interface MemoryCache
initialize
in class AbstractMemoryCache
hub
- public void update(ICacheElement ce) throws java.io.IOException
update
in interface MemoryCache
update
in class AbstractMemoryCache
ce
- Description of the Parameter
java.io.IOException
public void removeAll() throws java.io.IOException
removeAll
in interface MemoryCache
removeAll
in class AbstractMemoryCache
java.io.IOException
public ICacheElement getQuiet(java.io.Serializable key) throws java.io.IOException
getQuiet
in interface MemoryCache
getQuiet
in class AbstractMemoryCache
key
- Identifies item to find
java.io.IOException
public ICacheElement get(java.io.Serializable key) throws java.io.IOException
get
in interface MemoryCache
get
in class AbstractMemoryCache
key
- Identifies item to find
java.io.IOException
public boolean remove(java.io.Serializable key) throws java.io.IOException
remove
in interface MemoryCache
remove
in class AbstractMemoryCache
key
-
java.io.IOException
public java.util.Iterator getIterator()
getIterator
in interface MemoryCache
getIterator
in class AbstractMemoryCache
public java.lang.Object[] getKeyArray()
getKeyArray
in interface MemoryCache
getKeyArray
in class AbstractMemoryCache
private void removeNode(MemoryElementDescriptor me)
me
- Description of the Parameterprivate void addLast(CacheElement ce)
ce
- The feature to be added to the Lastprivate void addFirst(ICacheElement ce)
ce
- The feature to be added to the Firstpublic void makeFirst(ICacheElement ce)
ce
- Description of the Parameterpublic void makeFirst(MemoryElementDescriptor me)
me
- Description of the Parameterpublic void dumpMap()
public void dumpCacheEntries()
private int dumpCacheSize()
private void verifyCache()
private void verifyCache(java.io.Serializable key)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |