org.apache.jcs.engine.memory.lru
Class LRUMemoryCache

java.lang.Object
  extended by org.apache.jcs.engine.memory.AbstractMemoryCache
      extended by org.apache.jcs.engine.memory.AbstractDoulbeLinkedListMemoryCache
          extended by org.apache.jcs.engine.memory.lru.LRUMemoryCache
All Implemented Interfaces:
java.io.Serializable, IMemoryCache, MemoryCache

public class LRUMemoryCache
extends AbstractDoulbeLinkedListMemoryCache

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 efficient 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

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.jcs.engine.memory.AbstractDoulbeLinkedListMemoryCache
AbstractDoulbeLinkedListMemoryCache.IteratorWrapper, AbstractDoulbeLinkedListMemoryCache.MapEntryWrapper
 
Field Summary
 
Fields inherited from class org.apache.jcs.engine.memory.AbstractDoulbeLinkedListMemoryCache
hitCnt, list, missCnt
 
Fields inherited from class org.apache.jcs.engine.memory.AbstractMemoryCache
attr, cache, cacheName, cattr, chunkSize, map, status
 
Constructor Summary
LRUMemoryCache()
           
 
Method Summary
protected  void adjustListForGet(MemoryElementDescriptor me)
          Makes the item the first in the list.
protected  MemoryElementDescriptor adjustListForUpdate(ICacheElement ce)
          Puts an item to the cache.
 
Methods inherited from class org.apache.jcs.engine.memory.AbstractDoulbeLinkedListMemoryCache
addFirst, addLast, createMap, dumpCacheEntries, dumpCacheSize, dumpMap, freeElements, get, getIterator, getKeyArray, getStatistics, initialize, remove, removeAll, spoolLastElement, update, verifyCache
 
Methods inherited from class org.apache.jcs.engine.memory.AbstractMemoryCache
dispose, getCacheAttributes, getCacheName, getCompositeCache, getGroupKeys, getMultiple, getQuiet, getSize, getStatus, setCacheAttributes, waterfal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LRUMemoryCache

public LRUMemoryCache()
Method Detail

adjustListForUpdate

protected MemoryElementDescriptor adjustListForUpdate(ICacheElement ce)
                                               throws java.io.IOException
Puts an item to the cache. Removes any pre-existing entries of the same key from the linked list and adds this one first.

Specified by:
adjustListForUpdate in class AbstractDoulbeLinkedListMemoryCache
Parameters:
ce - The cache element, or entry wrapper
Returns:
MemoryElementDescriptor the new node
Throws:
java.io.IOException

adjustListForGet

protected void adjustListForGet(MemoryElementDescriptor me)
Makes the item the first in the list.

Specified by:
adjustListForGet in class AbstractDoulbeLinkedListMemoryCache
Parameters:
me -


Copyright © 2002-2010 Apache Software Foundation. All Rights Reserved.