Class 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
    • Field Detail

      • maxSize

        protected int maxSize
      • cache

        protected Map cache
    • Constructor Detail

      • ConcurrentFixedCache

        public ConcurrentFixedCache()
        Create a new concurrent cache, with a fixed size of 100.
      • ConcurrentFixedCache

        public ConcurrentFixedCache​(int maxSize)
        Create a new concurrent cache, with the max size.
    • 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()
      • put

        public void put​(Object key,
                        Object value)
        Add the value to the cache. Remove the
      • remove

        public void remove​(Object key)
        Remove from cache.
      • getCache

        public Map getCache()
        Return the cache.