Package org.apache.struts2.ognl
Class OgnlLRUCache<K,V>
java.lang.Object
org.apache.struts2.ognl.OgnlLRUCache<K,V>
- Type Parameters:
K- The type for the cache key entriesV- The type for the cache value entries
- All Implemented Interfaces:
OgnlCache<K,V>
A basic OGNL LRU cache implementation.
The implementation utilizes a Collections.synchronizedMap(java.util.Map)
backed by a LinkedHashMap. May be replaced by a more efficient implementation in the future.
Setting too low an eviction limit will produce more overhead than value.
Setting too high an eviction limit may also produce more overhead than value.
An appropriate eviction limit will need to be determined on an individual application basis.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()intvoidvoidputIfAbsent(K key, V value) voidsetEvictionLimit(int cacheEvictionLimit) intsize()
-
Constructor Details
-
OgnlLRUCache
public OgnlLRUCache(int evictionLimit, int initialCapacity, float loadFactor)
-
-
Method Details
-
get
-
put
-
putIfAbsent
- Specified by:
putIfAbsentin interfaceOgnlCache<K,V>
-
size
public int size() -
clear
public void clear() -
getEvictionLimit
public int getEvictionLimit()- Specified by:
getEvictionLimitin interfaceOgnlCache<K,V>
-
setEvictionLimit
public void setEvictionLimit(int cacheEvictionLimit) - Specified by:
setEvictionLimitin interfaceOgnlCache<K,V>
-