org.xwiki.cache.eviction
Class EntryEvictionConfiguration

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<String,Object>
          extended by org.xwiki.cache.eviction.EntryEvictionConfiguration
All Implemented Interfaces:
Serializable, Cloneable, Map<String,Object>
Direct Known Subclasses:
LRUEvictionConfiguration

public class EntryEvictionConfiguration
extends HashMap<String,Object>

This configuration class is used to add constraints in the configuration of the cache to create.

CacheFactory factory = (CacheFactory) getComponentManager().lookup(CacheFactory.class, this.roleHint); CacheConfiguration conf = new CacheConfiguration(); LRUEvictionConfiguration lec = new LRUEvictionConfiguration(); lec.setMaxEntries(1); conf.put(LRUEvictionConfiguration.CONFIGURATIONID, lec);

See Also:
Serialized Form

Nested Class Summary
static class EntryEvictionConfiguration.Algorithm
          The ordering/storing algorithm used by the cache.
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Field Summary
static String CONFIGURATIONID
          The key use to access eviction configuration in the CacheConfiguration.
static String TIMETOLIVE_ID
          The key used to access time to live duration in the EntryEvictionConfiguration.
 
Constructor Summary
EntryEvictionConfiguration()
           
 
Method Summary
 EntryEvictionConfiguration.Algorithm getAlgorithm()
           
 int getTimeToLive()
           
 void setAlgorithm(EntryEvictionConfiguration.Algorithm mode)
           
 void setTimeToLive(int timeToLive)
           
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

CONFIGURATIONID

public static final String CONFIGURATIONID
The key use to access eviction configuration in the CacheConfiguration.

See Also:
Constant Field Values

TIMETOLIVE_ID

public static final String TIMETOLIVE_ID
The key used to access time to live duration in the EntryEvictionConfiguration.

See Also:
Constant Field Values
Constructor Detail

EntryEvictionConfiguration

public EntryEvictionConfiguration()
Method Detail

setAlgorithm

public void setAlgorithm(EntryEvictionConfiguration.Algorithm mode)
Parameters:
mode - the ordering/storing algorithm used by the cache.

getAlgorithm

public EntryEvictionConfiguration.Algorithm getAlgorithm()
Returns:
the ordering/storing algorithm used by the cache.

setTimeToLive

public void setTimeToLive(int timeToLive)
Parameters:
timeToLive - the maximum time to live in seconds of a cache entry.

getTimeToLive

public int getTimeToLive()
Returns:
the maximum time to live in seconds of a cache entry.