edu.tum.cs.commons.cache
Class LRUCacheBase<I,H,E,X extends java.lang.Exception>
java.lang.Object
edu.tum.cs.commons.cache.CacheBase<I,H,E,X>
edu.tum.cs.commons.cache.LRUCacheBase<I,H,E,X>
- Type Parameters:
I
- the index type of the cacheH
- the hash map key typeE
- the type stored in the cacheX
- the type of exception thrown by the CacheBase.obtainItem(Object)
method. Use the NeverThrownRuntimeException
if no
exception will be thrown.
- Direct Known Subclasses:
- LRUStraightCacheBase
public abstract class LRUCacheBase<I,H,E,X extends java.lang.Exception>
- extends CacheBase<I,H,E,X>
A cache with a fixed size using a last recently used (LRU) strategy. If
identifiers itself are suitable hash keys, use class
LRUStraightCacheBase
.
- Version:
- $Rev: 26268 $
- Author:
- hummelb, $Author: juergens $
- Rating:
- GREEN Hash: 7C20602D714E70624D8FF1B0F6BAAEFF
Method Summary |
E |
getItem(I identifier)
Obtain an item from the cache. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LRUCacheBase
public LRUCacheBase(int maxSize)
- Constructor.
getItem
public E getItem(I identifier)
throws X extends java.lang.Exception
- Obtain an item from the cache. If the item was not cached yet, it will be
cached.
- Specified by:
getItem
in class CacheBase<I,H,E,X extends java.lang.Exception>
- Parameters:
identifier
- an object identifying the item to retrieve from the cache.
This class' implementation works with a hash map so
identifiers must adhere to the conventions for
Object.hashcode()
.
- Returns:
- The item.
- Throws:
X extends java.lang.Exception
TUM CCSM Commons - 2.7