Module org.eclipse.persistence.core
Class ConcurrentFixedCache
- java.lang.Object
-
- org.eclipse.persistence.internal.helper.ConcurrentFixedCache
-
- All Implemented Interfaces:
Serializable
public class ConcurrentFixedCache extends Object implements Serializable
Provide a concurrent fixed size caching mechanism. This is used for caching EJBQL parsed queries, Update calls, and other places a fixed size cache is needed. The default fixed size is 100.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ConcurrentFixedCache()Create a new concurrent cache, with a fixed size of 100.ConcurrentFixedCache(int maxSize)Create a new concurrent cache, with the max size.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Objectget(Object key)Return the pre-parsed query that represents the EJBQL string.MapgetCache()Return the cache.intgetMaxSize()Return the fixed size of the parse cache.voidput(Object key, Object value)Add the value to the cache.voidremove(Object key)Remove from cache.voidsetMaxSize(int maxSize)Set the fixed size of the parse cache.
-
-
-
Field Detail
-
maxSize
protected int maxSize
-
cache
protected Map cache
-
-
Method Detail
-
getMaxSize
public int getMaxSize()
Return the fixed size of the parse cache.
-
setMaxSize
public void setMaxSize(int maxSize)
Set the fixed size of the parse cache. When the size is exceeded, subsequent EJBQL will not be cached. The default size is 100;
-
get
public Object get(Object key)
Return the pre-parsed query that represents the EJBQL string. If the EJBQL has not been cached, null is returned.
-
clear
public void clear()
-
remove
public void remove(Object key)
Remove from cache.
-
getCache
public Map getCache()
Return the cache.
-
-