com.easyjf.cache.store
Class LfuMemoryStore

java.lang.Object
  extended bycom.easyjf.cache.store.MemoryStore
      extended bycom.easyjf.cache.store.LfuMemoryStore
All Implemented Interfaces:
Store

public class LfuMemoryStore
extends MemoryStore

Least Frequently Used (LFU) implementation of the memory store.

Version:
$Id: LfuMemoryStore.java,v 1.11 2005/10/15 17:32:30 gregluck Exp $ Warning: Testing of this store reveals some problems with it. Do not use. It may be removed.
Author:
Surya Suravarapu

Nested Class Summary
 class LfuMemoryStore.ElementComparator
          A comparator class compares two elements.
 
Method Summary
 int compareElements(Element element1, Element element2)
          Compares its two arguments for order.
 void doPut(Element element)
          Puts an element into the cache
 Element remove(java.io.Serializable key)
          Removes an item from the cache.
 
Methods inherited from class com.easyjf.cache.store.MemoryStore
containsKey, create, dispose, get, getKeyArray, getKeySet, getQuiet, getSize, getSizeInBytes, getStatus, put, remove, removeAll, removeElement
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

doPut

public void doPut(Element element)
Puts an element into the cache


remove

public Element remove(java.io.Serializable key)
Removes an item from the cache.


compareElements

public int compareElements(Element element1,
                           Element element2)
                    throws java.lang.ClassCastException
Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

Parameters:
element1 - the first element to be compared.
element2 - the second element to be compared.
Returns:
a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
Throws:
java.lang.ClassCastException - if the arguments' types prevent them from being compared by this Comparator.