org.shiftone.cache.policy.fifo
Class FifoCache

java.lang.Object
  extended byorg.shiftone.cache.policy.AbstractPolicyCache
      extended byorg.shiftone.cache.policy.fifo.FifoCache
All Implemented Interfaces:
Cache, ReapableCache

class FifoCache
extends AbstractPolicyCache
implements ReapableCache

Class FifoCache

Version:
$Revision: 1.11 $
Author:
Jeff Drost

Field Summary
 
Fields inherited from class org.shiftone.cache.policy.AbstractPolicyCache
SHRINK_DIV
 
Constructor Summary
(package private) FifoCache(java.lang.String name, long timeoutMilliSeconds, int maxSize)
           
(package private) FifoCache(java.lang.String name, long timeoutMilliSeconds, int maxSize, EvictionListener evictionListener)
           
 
Method Summary
protected  CacheNode createNode(java.lang.Object key, java.lang.Object cacheObject)
          Create a new node.
protected  void delete(CacheNode node)
          Remove a node from the cache.
(package private)  java.lang.String dumpFifoKeys()
           
protected  CacheNode findNodeByKey(java.lang.Object key)
          Method findNodeByKey
protected  CacheNode getLeastValuableNode()
          This method will execute the cache's onEviction strategy.
 void removeExpiredElements()
          Method removeExpiredElements
protected  void revalueNode(CacheNode cacheNode)
          DO NOTHING
 int size()
          The number of key/value pares in the cache
 
Methods inherited from class org.shiftone.cache.policy.AbstractPolicyCache
addObject, clear, getMaxSize, getName, getObject, getTimeoutMilliSeconds, remove, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.shiftone.cache.Cache
addObject, clear, getObject, remove
 

Constructor Detail

FifoCache

FifoCache(java.lang.String name,
          long timeoutMilliSeconds,
          int maxSize)

FifoCache

FifoCache(java.lang.String name,
          long timeoutMilliSeconds,
          int maxSize,
          EvictionListener evictionListener)
Method Detail

findNodeByKey

protected CacheNode findNodeByKey(java.lang.Object key)
Description copied from class: AbstractPolicyCache
Method findNodeByKey

Specified by:
findNodeByKey in class AbstractPolicyCache

size

public int size()
Description copied from interface: Cache
The number of key/value pares in the cache

Specified by:
size in interface Cache

revalueNode

protected final void revalueNode(CacheNode cacheNode)
DO NOTHING

Specified by:
revalueNode in class AbstractPolicyCache

delete

protected void delete(CacheNode node)
Description copied from class: AbstractPolicyCache
Remove a node from the cache.

Specified by:
delete in class AbstractPolicyCache

getLeastValuableNode

protected CacheNode getLeastValuableNode()
Description copied from class: AbstractPolicyCache
This method will execute the cache's onEviction strategy. If this method is called, there will be at least one element in the cache to remove. The method itself does not need to check for the existance of a element.

This method is only called by shrinkToSize();

Specified by:
getLeastValuableNode in class AbstractPolicyCache

removeExpiredElements

public void removeExpiredElements()
Description copied from interface: ReapableCache
Method removeExpiredElements

Specified by:
removeExpiredElements in interface ReapableCache
Specified by:
removeExpiredElements in class AbstractPolicyCache

createNode

protected CacheNode createNode(java.lang.Object key,
                               java.lang.Object cacheObject)
Description copied from class: AbstractPolicyCache
Create a new node.

Specified by:
createNode in class AbstractPolicyCache

dumpFifoKeys

java.lang.String dumpFifoKeys()