Class AbstractMTAsynchronouslyRefreshedCache<T>

java.lang.Object
org.alfresco.util.cache.AbstractAsynchronouslyRefreshedCache<T>
org.alfresco.repo.cache.AbstractMTAsynchronouslyRefreshedCache<T>
All Implemented Interfaces:
Callable<Void>, AsynchronouslyRefreshedCache<T>, RefreshableCache<T>, org.alfresco.util.cache.AsynchronouslyRefreshedCache<T>, org.alfresco.util.cache.RefreshableCache<T>, org.alfresco.util.cache.RefreshableCacheListener, org.alfresco.util.transaction.TransactionListener, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean
Direct Known Subclasses:
AuthorityBridgeTableAsynchronouslyRefreshedCache, ConfigDataCache

public abstract class AbstractMTAsynchronouslyRefreshedCache<T> extends org.alfresco.util.cache.AbstractAsynchronouslyRefreshedCache<T> implements AsynchronouslyRefreshedCache<T>, org.springframework.beans.factory.InitializingBean
The base implementation for Multi-tenant asynchronously refreshed cache. Currently supports one value per tenant. Implementors just need to provide buildCache(String tennantId)
Since:
4.1.3
Author:
Andy
  • Constructor Details

    • AbstractMTAsynchronouslyRefreshedCache

      public AbstractMTAsynchronouslyRefreshedCache()
  • Method Details

    • setTenantService

      public void setTenantService(TenantService tenantService)
      Parameters:
      tenantService - the tenantService to set
    • get

      public T get()
      Description copied from interface: RefreshableCache
      Get the cache. If there is no cache value this call will block. If the underlying cache is being refreshed, the old cache value will be returned until the refresh is complete.
      Specified by:
      get in interface RefreshableCache<T>
      Returns:
      T
    • forceInChangesForThisUncommittedTransaction

      public void forceInChangesForThisUncommittedTransaction()
    • refresh

      public void refresh()
      Description copied from interface: RefreshableCache
      Refresh the cache asynchronously.
      Specified by:
      refresh in interface RefreshableCache<T>
    • isUpToDate

      public boolean isUpToDate()
      Description copied from interface: AsynchronouslyRefreshedCache
      Determine if the cache is up to date
      Specified by:
      isUpToDate in interface AsynchronouslyRefreshedCache<T>
      Returns:
      true if the cache is not currently refreshing itself
    • buildCache

      protected abstract T buildCache(String tenantId)
      Build the cache entry for the specific tenant. This method is called in a thread-safe manner i.e. it is only ever called by a single thread.
      Specified by:
      buildCache in class org.alfresco.util.cache.AbstractAsynchronouslyRefreshedCache<T>
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Overrides:
      afterPropertiesSet in class org.alfresco.util.cache.AbstractAsynchronouslyRefreshedCache<T>
      Throws:
      Exception