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

      • AbstractMTAsynchronouslyRefreshedCache

        public AbstractMTAsynchronouslyRefreshedCache()
    • Method Detail

      • setTenantService

        public void setTenantService​(org.alfresco.repo.tenant.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()
      • 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