Class ConcurrentFixedCache

  • All Implemented Interfaces:
    java.io.Serializable

    public class ConcurrentFixedCache
    extends java.lang.Object
    implements java.io.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 Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Map cache  
      protected int maxSize  
    • 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
      void clear()  
      java.lang.Object get​(java.lang.Object key)
      Return the pre-parsed query that represents the EJBQL string.
      java.util.Map getCache()
      Return the cache.
      int getMaxSize()
      Return the fixed size of the parse cache.
      void put​(java.lang.Object key, java.lang.Object value)
      Add the value to the cache.
      void remove​(java.lang.Object key)
      Remove from cache.
      void setMaxSize​(int maxSize)
      Set the fixed size of the parse cache.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • maxSize

        protected int maxSize
      • cache

        protected java.util.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 java.lang.Object get​(java.lang.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​(java.lang.Object key,
                        java.lang.Object value)
        Add the value to the cache. Remove the
      • remove

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

        public java.util.Map getCache()
        Return the cache.