@ExperimentalApi public interface RequestCacheFactory
This is intended to be added to JIRA 6.4 for experimental use in performance fixes. Eventually, it will likely be replaced by a similar mechanism in atlassian-cache but we can use this to iron out desired usage patterns.
|Modifier and Type||Method and Description|
Creates a new request-scoped cache with no default cache loader.
Creates a new request-scoped cache.
<K,V> RequestCache<K,V> createRequestCache(String name)
The cache will behave identically to one created by
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.
<K,V> RequestCache<K,V> createRequestCache(String name, com.atlassian.cache.CacheLoader<K,V> cacheLoader)
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.
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
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)
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-cacheAPI. 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
Copyright © 2002-2022 Atlassian. All Rights Reserved.