Class ApplicationCacheAccessor

java.lang.Object
org.silverpeas.kernel.cache.service.ApplicationCacheAccessor
All Implemented Interfaces:
CacheAccessor<ExternalCache>

public class ApplicationCacheAccessor extends Object implements CacheAccessor<ExternalCache>
An accessor to a cache whose lifetime is within the whole application runtime. This accessor uses a specific implementation of the cache that is retrieved by using the Java Service Loader mechanism. So, through this accessor you can use tiers caching subsystem like Infinispan or EhCache for example, for better performance. This is why this accessor maintains only a single instance of such a cache. In the case no external cache is available, then by default an in-memory cache is used, meaning no additional cache functionalities (like time-to-live for example) are supported.
Author:
mmoquillon
API Note:
The ApplicationCacheAccessor is a singleton.
  • Method Details

    • getInstance

      public static ApplicationCacheAccessor getInstance()
      Gets the single instance of ApplicationCacheAccessor.
      Returns:
      the single instance of this class.
    • getCache

      public ExternalCache getCache()
      Description copied from interface: CacheAccessor
      Gets an instance of the cache referred by this accessor. Despite the method can return at each call either the same instance or different instances, the cache represented by the instances will be the same.
      Specified by:
      getCache in interface CacheAccessor<ExternalCache>
      Returns:
      the cache referred by this accessor.