| |
|
| java.lang.Object java.util.AbstractMap com.opensymphony.oscache.base.algorithm.AbstractConcurrentReadCache com.opensymphony.oscache.base.algorithm.LRUCache
LRUCache | public class LRUCache extends AbstractConcurrentReadCache (Code) | | LRU (Least Recently Used) algorithm for the cache.
Since release 2.3 this class requires Java 1.4
to use the LinkedHashSet . Use prior OSCache release which
require the Jakarta commons-collections SequencedHashMap
class or the LinkedList class if neither of the above
classes are available.
No synchronization is required in this class since the
AbstractConcurrentReadCache already takes care of any
synchronization requirements.
version: $Revision: 427 $ author: Victor Salaman author: Francois Beauregard author: Alain Bergevin author: Chris Miller |
Constructor Summary | |
public | LRUCache() Constructs an LRU Cache. | public | LRUCache(int capacity) Constructors a LRU Cache of the specified capacity. |
Method Summary | |
protected void | itemPut(Object key) An object was put in the cache. | protected void | itemRemoved(Object key) Remove specified key since that object has been removed from the cache. | protected void | itemRetrieved(Object key) An item was retrieved from the list. | protected Object | removeItem() An item needs to be removed from the cache. |
LRUCache | public LRUCache()(Code) | | Constructs an LRU Cache.
|
LRUCache | public LRUCache(int capacity)(Code) | | Constructors a LRU Cache of the specified capacity.
Parameters: capacity - The maximum cache capacity. |
itemPut | protected void itemPut(Object key)(Code) | | An object was put in the cache. This implementation adds/moves the
key to the end of the list.
Parameters: key - The cache key of the item that was put. |
itemRemoved | protected void itemRemoved(Object key)(Code) | | Remove specified key since that object has been removed from the cache.
Parameters: key - The cache key of the item that was removed. |
itemRetrieved | protected void itemRetrieved(Object key)(Code) | | An item was retrieved from the list. The LRU implementation moves
the retrieved item's key to the front of the list.
Parameters: key - The cache key of the item that was retrieved. |
removeItem | protected Object removeItem()(Code) | | An item needs to be removed from the cache. The LRU implementation
removes the first element in the list (ie, the item that was least-recently
accessed).
The key of whichever item was removed. |
|
|
|