Package org.xwiki.cache.eviction
Class EntryEvictionConfiguration
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<String,Object>
-
- 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);- Version:
- $Id: 8c63261a8d7b04a568a0bbf424f129bb3a68426e $
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEntryEvictionConfiguration.AlgorithmThe ordering/storing algorithm used by the cache.-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Field Summary
Fields Modifier and Type Field Description static StringCONFIGURATIONIDThe key use to access eviction configuration in theCacheConfiguration.static StringTIMETOLIVE_ID
-
Constructor Summary
Constructors Constructor Description EntryEvictionConfiguration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EntryEvictionConfiguration.AlgorithmgetAlgorithm()intgetTimeToLive()voidsetAlgorithm(EntryEvictionConfiguration.Algorithm mode)voidsetTimeToLive(int timeToLive)-
Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
-
-
-
Field Detail
-
CONFIGURATIONID
public static final String CONFIGURATIONID
The key use to access eviction configuration in theCacheConfiguration.- See Also:
- Constant Field Values
-
TIMETOLIVE_ID
public static final String TIMETOLIVE_ID
- See Also:
getTimeToLive(), Constant Field Values
-
-
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- seegetTimeToLive()
-
getTimeToLive
public int getTimeToLive()
- Returns:
- the time a cache entry will continue to stay in the cache after being last accessed, in seconds. When the time is reached, the entry is expired and removed from the cache. In addition, when the cache reaches its maximum number of entries, the defined eviction algorithm is used (e.g. LRU) and thus an entry can stay less time in the cache than its maximum defined time.
-
-