Class LRUMemoryCache<K,V>
java.lang.Object
org.apache.commons.jcs3.engine.memory.AbstractMemoryCache<K,V>
org.apache.commons.jcs3.engine.memory.AbstractDoubleLinkedListMemoryCache<K,V>
org.apache.commons.jcs3.engine.memory.lru.LRUMemoryCache<K,V>
- All Implemented Interfaces:
IMemoryCache<K,
V>
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
bottlenecks 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
-
Field Summary
Fields inherited from class org.apache.commons.jcs3.engine.memory.AbstractDoubleLinkedListMemoryCache
list
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Makes the item the first in the list.protected MemoryElementDescriptor<K,
V> Puts an item to the cache.Methods inherited from class org.apache.commons.jcs3.engine.memory.AbstractDoubleLinkedListMemoryCache
addFirst, addLast, createMap, freeElements, get, getStatistics, initialize, lockedGetElement, lockedRemoveAll, lockedRemoveElement, update
Methods inherited from class org.apache.commons.jcs3.engine.memory.AbstractMemoryCache
dispose, dumpMap, getCacheAttributes, getCacheName, getCompositeCache, getKeySet, getMultiple, getQuiet, getSize, remove, removeAll, removeByGroup, removeByHierarchy, setCacheAttributes, waterfal
-
Constructor Details
-
LRUMemoryCache
public LRUMemoryCache()
-
-
Method Details
-
adjustListForUpdate
protected MemoryElementDescriptor<K,V> adjustListForUpdate(ICacheElement<K, V> ce) throws IOExceptionPuts 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 classAbstractDoubleLinkedListMemoryCache<K,
V> - Parameters:
ce
- The cache element, or entry wrapper- Returns:
- MemoryElementDescriptor the new node
- Throws:
IOException
-
adjustListForGet
Makes the item the first in the list.- Specified by:
adjustListForGet
in classAbstractDoubleLinkedListMemoryCache<K,
V> - Parameters:
me
-
-