Save This Page
Home » oscache-2.4.1-full » com.opensymphony.oscache » base » algorithm » [javadoc | source]
com.opensymphony.oscache.base.algorithm
public class: LRUCache [javadoc | source]
java.lang.Object
   com.opensymphony.oscache.base.algorithm.AbstractConcurrentReadCache
      com.opensymphony.oscache.base.algorithm.LRUCache

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.

Constructor:
 public LRUCache() 
 public LRUCache(int capacity) 
Method from com.opensymphony.oscache.base.algorithm.LRUCache Summary:
itemPut,   itemRemoved,   itemRetrieved,   removeItem
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.opensymphony.oscache.base.algorithm.LRUCache Detail:
 protected  void itemPut(Object key) 
    An object was put in the cache. This implementation adds/moves the key to the end of the list.
 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. The LRU implementation moves the retrieved item's key to the front of the list.
 protected Object removeItem() 
    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).