com.j_spaces.map.eviction
Class FIFOEvictionStrategy

java.lang.Object
  extended by com.j_spaces.map.eviction.AbstractEvictionStrategy
      extended by com.j_spaces.map.eviction.FIFOEvictionStrategy
All Implemented Interfaces:
EvictionStrategy
Direct Known Subclasses:
LRUEvictionStrategy

public class FIFOEvictionStrategy
extends AbstractEvictionStrategy

first-in first-out (as opposed to LIFO � last-in first-out) Items come out in the same order they came in.

Since:
5.0

Constructor Summary
FIFOEvictionStrategy()
           
 
Method Summary
 void clear()
          Clear EvictionStrategy internal structures only and doesn't clear cache.
 CacheEntry createEntry(Object key, Object value, Attribute[] attributes, long ttl, int version)
          Creates new CacheEntry for the Cache and probably saves the entry in the internal structures.
 CacheEntry createEntry(Object key, Object value, long ttl, int version)
          Creates new CacheEntry for the Cache and probably saves the entry in the internal structures.
 void discardEntry(CacheEntry entry)
          Discard an Entry from the EvictionStrategy internal structures.
 int evict(Cache cache)
          Evicts batch of CacheEntry from the Cache according to the eviction strategy.
 void touchEntry(CacheEntry entry)
          Informs the eviction strategy on a CacheEntry use.
 
Methods inherited from class com.j_spaces.map.eviction.AbstractEvictionStrategy
setBatchSize
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FIFOEvictionStrategy

public FIFOEvictionStrategy()
Method Detail

clear

public void clear()
Description copied from interface: EvictionStrategy
Clear EvictionStrategy internal structures only and doesn't clear cache.


discardEntry

public void discardEntry(CacheEntry entry)
Discard an Entry from the EvictionStrategy internal structures.

Parameters:
entry - the entry to discard from the eviction strategy internal structures

evict

public int evict(Cache cache)
Description copied from interface: EvictionStrategy
Evicts batch of CacheEntry from the Cache according to the eviction strategy.

Parameters:
cache - the cache to be evicted
Returns:
the amount of entries evicted

touchEntry

public void touchEntry(CacheEntry entry)
Informs the eviction strategy on a CacheEntry use.

Parameters:
entry - the touched entry

createEntry

public CacheEntry createEntry(Object key,
                              Object value,
                              Attribute[] attributes,
                              long ttl,
                              int version)
Creates new CacheEntry for the Cache and probably saves the entry in the internal structures.

Parameters:
key - the entry key
value - the entry value
attributes - the entry attributes
ttl - the time to keep the entry in cache
version - the entry version
Returns:
a CacheEntry that holds all the parameters and probably saved in the eviction strategy internal structures

createEntry

public CacheEntry createEntry(Object key,
                              Object value,
                              long ttl,
                              int version)
Creates new CacheEntry for the Cache and probably saves the entry in the internal structures.

Parameters:
key - the entry key
value - the entry value
ttl - the time to keep the entry in cache
version - the entry version
Returns:
a CacheEntry that holds all the parameters and probably saved in the eviction strategy internal structures