Class CommonEhCacheCacheService

    • Field Detail

      • cacheManager

        protected net.sf.ehcache.CacheManager cacheManager
      • cacheConfigurations

        protected final java.util.Map<java.lang.String,​net.sf.ehcache.config.CacheConfiguration> cacheConfigurations
    • Method Detail

      • getEhCacheConfiguration

        protected net.sf.ehcache.config.CacheConfiguration getEhCacheConfiguration​(CacheConfiguration cacheConfig)
      • buildCacheManagerWithDefaultConfiguration

        protected void buildCacheManagerWithDefaultConfiguration()
      • getCacheManagerIdentifier

        protected abstract java.lang.String getCacheManagerIdentifier()
      • createCache

        protected net.sf.ehcache.Cache createCache​(java.lang.String cacheName,
                                                   java.lang.String internalCacheName)
                                            throws SCacheException
        Throws:
        SCacheException
      • store

        public void store​(java.lang.String cacheName,
                          java.io.Serializable key,
                          java.lang.Object value)
                   throws SCacheException
        Description copied from interface: CommonCacheService
        Store an object in the cache. If the cache don't exists it will be created.
        Specified by:
        store in interface CommonCacheService
        Parameters:
        cacheName - The name of the cache in which the object must be stored
        key - The key that will allow to retrieve the object
        value - The object to store
        Throws:
        SCacheException - Error thrown if has exceptions during the cache store.
      • getKeyFromCacheName

        protected abstract java.lang.String getKeyFromCacheName​(java.lang.String cacheName)
                                                         throws SCacheException
        Throws:
        SCacheException
      • get

        public java.lang.Object get​(java.lang.String cacheName,
                                    java.lang.Object key)
                             throws SCacheException
        Description copied from interface: CommonCacheService
        Get a cached object.
        Specified by:
        get in interface CommonCacheService
        Parameters:
        cacheName - The name of the cache on which to get the object
        key - The key that is used to store the object
        Returns:
        the cached object, or null if it doesn't exists
        Throws:
        SCacheException - Error thrown if has exceptions during the cache object get.
      • clear

        public boolean clear​(java.lang.String cacheName)
                      throws SCacheException
        Description copied from interface: CommonCacheService
        Clear the cache named by cacheName
        Specified by:
        clear in interface CommonCacheService
        Parameters:
        cacheName - The name of the cache to clear
        Returns:
        Throws:
        SCacheException - Error thrown if has exceptions during the cache clear.
      • getCacheSize

        public int getCacheSize​(java.lang.String cacheName)
                         throws SCacheException
        Description copied from interface: CommonCacheService
        Return the size of the cache with cacheName.
        Specified by:
        getCacheSize in interface CommonCacheService
        Parameters:
        cacheName - The name of cache
        Returns:
        the size of the named cache
        Throws:
        SCacheException - if no cache is found with that name.
      • remove

        public boolean remove​(java.lang.String cacheName,
                              java.lang.Object key)
                       throws SCacheException
        Description copied from interface: CommonCacheService
        Remove the element according to the cache name and the key
        Specified by:
        remove in interface CommonCacheService
        key - The name of the cache where the object must be stored The key that will allow to retrieve the object
        Returns:
        true if an element was removed
        Throws:
        SCacheException - Error thrown if has exceptions during the cache remove.
      • getKeys

        public java.util.List<java.lang.Object> getKeys​(java.lang.String cacheName)
                                                 throws SCacheException
        Description copied from interface: CommonCacheService
        Get list of keys on a cache.
        Specified by:
        getKeys in interface CommonCacheService
        Parameters:
        cacheName - The name of the cache on which to get the key list
        Returns:
        the list of keys on the cache, or null if no keys exist
        Throws:
        SCacheException
      • shutdownCacheManager

        protected void shutdownCacheManager()
      • getCacheManagerName

        protected abstract java.lang.String getCacheManagerName()