Class BeCPGCacheServiceImpl

java.lang.Object
fr.becpg.repo.cache.impl.BeCPGCacheServiceImpl
All Implemented Interfaces:
BeCPGCacheService, org.alfresco.util.cache.RefreshableCacheListener, org.springframework.beans.factory.InitializingBean

public class BeCPGCacheServiceImpl extends Object implements BeCPGCacheService, org.springframework.beans.factory.InitializingBean, org.alfresco.util.cache.RefreshableCacheListener

BeCPGCacheServiceImpl class.

Version:
$Id: $Id
Author:
matthieu
  • Field Details

    • logger

      private static final org.apache.commons.logging.Log logger
    • cacheSizes

      Map<String,Integer> cacheSizes
    • isDebugEnable

      private boolean isDebugEnable
    • disableAllCache

      private boolean disableAllCache
    • registry

      private org.alfresco.util.cache.AsynchronouslyRefreshedCacheRegistry registry
    • INITIAL_CACHE_MAP_SIZE

      private static final int INITIAL_CACHE_MAP_SIZE
      See Also:
    • caches

      private Map<String,org.alfresco.repo.cache.SimpleCache<String,?>> caches
  • Constructor Details

    • BeCPGCacheServiceImpl

      public BeCPGCacheServiceImpl()
  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
    • setDisableAllCache

      public void setDisableAllCache(boolean disableAllCache)

      Setter for the field disableAllCache.

      Parameters:
      disableAllCache - a boolean.
    • setCacheSizes

      public void setCacheSizes(Map<String,Integer> cacheSizes)

      Setter for the field cacheSizes.

      Parameters:
      cacheSizes - a Map object.
    • setRegistry

      public void setRegistry(org.alfresco.util.cache.AsynchronouslyRefreshedCacheRegistry registry)

      Setter for the field registry.

      Parameters:
      registry - a AsynchronouslyRefreshedCacheRegistry object
    • getFromCache

      public <T> T getFromCache(String cacheName, String cacheKey, Supplier<T> cacheDataProviderCallBack)

      getFromCache.

      Specified by:
      getFromCache in interface BeCPGCacheService
      Type Parameters:
      T - a T class
      Parameters:
      cacheName - a String object.
      cacheKey - a String object.
      cacheDataProviderCallBack - a Supplier object.
      Returns:
      a T object.
    • storeInCache

      public <T> void storeInCache(String cacheName, String cacheKey, T data)

      storeInCache.

      Specified by:
      storeInCache in interface BeCPGCacheService
      Type Parameters:
      T - a T class
      Parameters:
      cacheName - a String object.
      cacheKey - a String object.
      data - a T object.
    • getFromCache

      public <T> T getFromCache(String cacheName, String cacheKey)

      getFromCache.

      Specified by:
      getFromCache in interface BeCPGCacheService
      Type Parameters:
      T - a T class
      Parameters:
      cacheName - a String object.
      cacheKey - a String object..
      Returns:
      a T object.
    • getFromCache

      public <T> T getFromCache(String cacheName, String cacheKey, Supplier<T> cacheDataProviderCallBack, boolean deleteOnTxRollback)

      getFromCache.

      Specified by:
      getFromCache in interface BeCPGCacheService
      Type Parameters:
      T - a T class
      Parameters:
      cacheName - a String object.
      cacheKey - a String object.
      cacheDataProviderCallBack - a Supplier object.
      deleteOnTxRollback - a boolean.
      Returns:
      a T object.
    • removeFromCache

      public void removeFromCache(String cacheName, String cacheKey)

      removeFromCache.

      Specified by:
      removeFromCache in interface BeCPGCacheService
      Parameters:
      cacheName - a String object.
      cacheKey - a String object.
    • getFromTransactionCache

      public <T> T getFromTransactionCache(String cacheName, String itemKey, Supplier<T> valueSupplier)
      Gets a value from the transaction cache, computing it if not present
      Specified by:
      getFromTransactionCache in interface BeCPGCacheService
      Type Parameters:
      T - The type of the value
      Parameters:
      cacheName - The cache name (used as part of the transaction resource key)
      itemKey - a String object
      valueSupplier - a Supplier object
      Returns:
      The cached or computed value
    • clearCache

      public void clearCache(String cacheName)

      clearCache.

      Specified by:
      clearCache in interface BeCPGCacheService
      Parameters:
      cacheName - a String object.
    • clearAllCaches

      public void clearAllCaches()

      clearAllCaches.

      Specified by:
      clearAllCaches in interface BeCPGCacheService
    • computeCacheKey

      private String computeCacheKey(String cacheKey)
    • printCacheInfos

      public void printCacheInfos()

      printCacheInfos.

      Specified by:
      printCacheInfos in interface BeCPGCacheService
    • onRefreshableCacheEvent

      public void onRefreshableCacheEvent(org.alfresco.util.cache.RefreshableCacheEvent refreshableCacheEvent)
      Specified by:
      onRefreshableCacheEvent in interface org.alfresco.util.cache.RefreshableCacheListener
    • getCacheId

      public String getCacheId()
      Specified by:
      getCacheId in interface org.alfresco.util.cache.RefreshableCacheListener