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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
int
void
void
putIfAbsent
(K key, V value) void
setEvictionLimit
(int cacheEvictionLimit) int
size()
-
Constructor Details
-
OgnlLRUCache
public OgnlLRUCache(int evictionLimit, int initialCapacity, float loadFactor)
-
-
Method Details
-
get
-
put
-
putIfAbsent
- Specified by:
putIfAbsent
in interfaceOgnlCache<K,
V>
-
size
public int size() -
clear
public void clear() -
getEvictionLimit
public int getEvictionLimit()- Specified by:
getEvictionLimit
in interfaceOgnlCache<K,
V>
-
setEvictionLimit
public void setEvictionLimit(int cacheEvictionLimit) - Specified by:
setEvictionLimit
in interfaceOgnlCache<K,
V>
-