Package org.apache.struts2.ognl
Class OgnlDefaultCache<K,V>
java.lang.Object
org.apache.struts2.ognl.OgnlDefaultCache<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>
Basic OGNL cache implementation.
This implementation is backed by a ConcurrentHashMap
that is cleared whenever the eviction limit is
surpassed.
Setting a very high eviction limit simulates an unlimited cache.
Setting too low an eviction limit will make the cache ineffective.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
int
void
void
putIfAbsent
(K key, V value) void
setEvictionLimit
(int cacheEvictionLimit) int
size()
-
Constructor Details
-
OgnlDefaultCache
public OgnlDefaultCache(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>
-