de.neteye.actioncache
Class AbstractCache

java.lang.Object
  |
  +--de.neteye.actioncache.AbstractCache
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ActionCache

public abstract class AbstractCache
extends java.lang.Object
implements java.io.Serializable

Abstract in-memory LRU cache. Lookups are performed using a HashMap. The items are double linked to determine their order. Whenever an item is accessed it is unlinked and re-inserted at the top of the list.

Version:
$Revision: 1.3 $
Author:
Felix Gnass
See Also:
Serialized Form

Constructor Summary
AbstractCache(int capacity)
           
 
Method Summary
protected abstract  CacheItem createCacheItem(java.lang.Object key)
           
 CacheItem getItem(java.lang.Object key)
           
 void setCapacity(int capacity)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCache

public AbstractCache(int capacity)
Method Detail

createCacheItem

protected abstract CacheItem createCacheItem(java.lang.Object key)
                                      throws java.lang.Exception
java.lang.Exception

getItem

public CacheItem getItem(java.lang.Object key)

setCapacity

public void setCapacity(int capacity)