com.atlassian.cache.compat
Class CacheManagerFactory

java.lang.Object
  extended by com.atlassian.cache.compat.CacheManagerFactory

@PublicApi
public class CacheManagerFactory
extends Object

A component that makes it possible to obtain a cache manager in a cross-product, cross-version way.

Your plugin should list an explicit dependency on the atlassian-cache-compat module, and define the CacheManagerFactory as a component. This will bring with it transitive dependencies on atlassian-cache-api and atlassian-cache-memory. When the plugin is installed in an application that provides suitable versions of these libraries, the implementation is inherited from the application and the cluster-safe version is returned by getCacheManager(). Otherwise, a local, memory-only implementation is substituted.

WARNING: The inheritance of the host application's implementation relies on the resolution of the OSGi bundle dependency, and this means in turn that the plugin must not use a newer version of the compatibility library than the version of the API that the host application provides. In other words, if compatibility library version 2.0.11 is used, then the host must provide atlassian-cache-api 2.0.11 or later for it to work.

Since:
v2.0.10

Constructor Summary
CacheManagerFactory()
           
 
Method Summary
 CacheManager getCacheManager()
          Obtain a reference to the cache manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheManagerFactory

public CacheManagerFactory()
Method Detail

getCacheManager

public CacheManager getCacheManager()
Obtain a reference to the cache manager.

Plugin components that need to use the CacheManager should have the CacheManagerFactory injected and use this method to get it instead of injecting the CacheManager directly.

Returns:
the appropriate CacheManager implementation.


Copyright © 2014 Atlassian. All Rights Reserved.