Class RequestCacheFactoryImpl

java.lang.Object
com.atlassian.jira.cache.request.RequestCacheFactoryImpl
All Implemented Interfaces:
RequestCacheFactory

public class RequestCacheFactoryImpl extends Object implements RequestCacheFactory
  • Constructor Details

  • Method Details

    • createRequestCache

      public <K, V> RequestCache<K,V> createRequestCache(String name)
      Description copied from interface: RequestCacheFactory
      Creates a new request-scoped cache with no default cache loader.

      The cache will behave identically to one created by RequestCacheFactory.createRequestCache(String, CacheLoader), except that calls to get without a supplier will throw an exception for values that are not already in the cache. This is mainly intended for cases where only the supplier form of get will be used exclusively and specifying a CacheLoader that would never be used is unnecessarily awkward.

      Specified by:
      createRequestCache in interface RequestCacheFactory
      Type Parameters:
      K - as for RequestCacheFactory.createRequestCache(String, CacheLoader)
      V - as for RequestCacheFactory.createRequestCache(String, CacheLoader)
      Parameters:
      name - as for RequestCacheFactory.createRequestCache(String, CacheLoader)
      Returns:
      as for RequestCacheFactory.createRequestCache(String, CacheLoader)
    • createRequestCache

      public <K, V> RequestCache<K,V> createRequestCache(String name, com.atlassian.cache.CacheLoader<K,V> cacheLoader)
      Description copied from interface: RequestCacheFactory
      Creates a new request-scoped cache.

      Any code that accesses the resulting request-scoped cache from within an HTTP request or a task scheduled using the atlassian-scheduler API will automatically inherit a request-scoped cache. See JiraThreadLocalUtil for alternative ways to establish a request context.

      If a request cache is queried when there is no context established, then caching is completely disabled. All requests to the cache are passed on to the CacheLoader.

      Specified by:
      createRequestCache in interface RequestCacheFactory
      Type Parameters:
      K - the type of keys used to look up values in this request cache
      V - the type of values returned by this request cache's loader (and therefore by the cache itself)
      Parameters:
      name - a name to identify the cache. Although no restrictions are currently enforced for this name (even uniqueness), the name SHOULD follow the recommended conventions of the atlassian-cache API. Specifically, it should be the fully qualified name of the owning class and the field it uses to hold the request cache reference, separated by a '.'.
      cacheLoader - the loader that provides cached values
      Returns:
      the newly created request cache