org.apache.jcs.engine.memory.mru
Class MRUMemoryCache<K extends Serializable,V extends Serializable>

java.lang.Object
  extended by org.apache.jcs.engine.memory.AbstractMemoryCache<K,V>
      extended by org.apache.jcs.engine.memory.AbstractDoubleLinkedListMemoryCache<K,V>
          extended by org.apache.jcs.engine.memory.mru.MRUMemoryCache<K,V>
All Implemented Interfaces:
Serializable, IRequireScheduler, IMemoryCache<K,V>

public class MRUMemoryCache<K extends Serializable,V extends Serializable>
extends AbstractDoubleLinkedListMemoryCache<K,V>

The most recently used items move to the front of the list and get spooled to disk if the cache hub is configured to use a disk cache.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.jcs.engine.memory.AbstractDoubleLinkedListMemoryCache
AbstractDoubleLinkedListMemoryCache.IteratorWrapper<K extends Serializable,V extends Serializable>, AbstractDoubleLinkedListMemoryCache.MapEntryWrapper<K extends Serializable,V extends Serializable>
 
Field Summary
 
Fields inherited from class org.apache.jcs.engine.memory.AbstractDoubleLinkedListMemoryCache
hitCnt, list, missCnt
 
Fields inherited from class org.apache.jcs.engine.memory.AbstractMemoryCache
cache, cacheAttributes, cacheName, chunkSize, elementAttributes, map, status
 
Constructor Summary
MRUMemoryCache()
           
 
Method Summary
protected  void adjustListForGet(MemoryElementDescriptor<K,V> me)
          Makes the item the last in the list.
protected  MemoryElementDescriptor<K,V> adjustListForUpdate(ICacheElement<K,V> ce)
          Adds the item to the front of the list.
 
Methods inherited from class org.apache.jcs.engine.memory.AbstractDoubleLinkedListMemoryCache
addFirst, addLast, createMap, dumpCacheEntries, dumpCacheSize, freeElements, get, getIterator, getKeySet, getStatistics, initialize, remove, removeAll, spoolLastElement, update, verifyCache
 
Methods inherited from class org.apache.jcs.engine.memory.AbstractMemoryCache
dispose, dumpMap, getCacheAttributes, getCacheName, getCompositeCache, getGroupKeys, getGroupNames, getMultiple, getQuiet, getSize, getStatus, setCacheAttributes, setScheduledExecutorService, waterfal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MRUMemoryCache

public MRUMemoryCache()
Method Detail

adjustListForUpdate

protected MemoryElementDescriptor<K,V> adjustListForUpdate(ICacheElement<K,V> ce)
                                                                                              throws IOException
Adds the item to the front of the list. A put doesn't count as a usage.

It's not clear if the put operation should be different. Perhaps this should remove the oldest if full, and then put.

Specified by:
adjustListForUpdate in class AbstractDoubleLinkedListMemoryCache<K extends Serializable,V extends Serializable>
Parameters:
ce -
Returns:
MemoryElementDescriptor the new node
Throws:
IOException

adjustListForGet

protected void adjustListForGet(MemoryElementDescriptor<K,V> me)
Makes the item the last in the list.

Specified by:
adjustListForGet in class AbstractDoubleLinkedListMemoryCache<K extends Serializable,V extends Serializable>
Parameters:
me -


Copyright © 2002-2013 The Apache Software Foundation. All Rights Reserved.