ehcache

net.sf.ehcache.store
Class LruMemoryStore.SpoolingLRUMap

java.lang.Object
  extended by org.apache.commons.collections.SequencedHashMap
      extended by org.apache.commons.collections.LRUMap
          extended by net.sf.ehcache.store.LruMemoryStore.SpoolingLRUMap
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, java.lang.Cloneable, java.util.Map
Enclosing class:
LruMemoryStore

public final class LruMemoryStore.SpoolingLRUMap
extends org.apache.commons.collections.LRUMap

An LRU Map implementation based on Apache Commons LRUMap.

This is used if LinkedHashMap is not found in the classpath. LinkedHashMap is part of JDK

See Also:
Serialized Form

Constructor Summary
LruMemoryStore.SpoolingLRUMap()
          Constructor.
 
Method Summary
protected  void processRemovedLRU(java.lang.Object key, java.lang.Object value)
          Called after the element has been removed.
 
Methods inherited from class org.apache.commons.collections.LRUMap
get, getMaximumSize, put, readExternal, removeLRU, setMaximumSize, writeExternal
 
Methods inherited from class org.apache.commons.collections.SequencedHashMap
clear, clone, containsKey, containsValue, entrySet, equals, get, getFirst, getFirstKey, getFirstValue, getLast, getLastKey, getLastValue, getValue, hashCode, indexOf, isEmpty, iterator, keySet, lastIndexOf, putAll, remove, remove, sequence, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LruMemoryStore.SpoolingLRUMap

public LruMemoryStore.SpoolingLRUMap()
Constructor. The maximum size is set to Ehcache.getMaxElementsInMemory(). If the LRUMap gets bigger than this, processRemovedLRU(java.lang.Object, java.lang.Object) is called.

Method Detail

processRemovedLRU

protected final void processRemovedLRU(java.lang.Object key,
                                       java.lang.Object value)
Called after the element has been removed.

Our choices are to do nothing or spool the element to disk.

Note that value will be null when the memory size is set to 0. Thus a null guard is used.

Overrides:
processRemovedLRU in class org.apache.commons.collections.LRUMap
Parameters:
key -
value -

ehcache