Class RequestCache

java.lang.Object
com.atlassian.plugin.webresource.impl.RequestCache

public class RequestCache extends Object
A place to store the results of operations performed during a single request-response lifecycle. The cache's primary goal is to "freeze" application state as it is interrogated, so that values are evaluated once and thus stable for the duration of the request-response lifecycle. Avoiding potentially expensive operations being run multiple times is a nice bonus. This class expects to be constructed per request. It is not an appropriate way to marshal and unmarshal application state across multiple requests from a client.
Since:
v3.3
  • Constructor Details

    • RequestCache

      public RequestCache(Globals globals)
  • Method Details

    • toResourceKeys

      public static List<ResourceKey> toResourceKeys(List<Resource> resources)
    • getGlobals

      public Globals getGlobals()
    • getCachedResources

      public Map<Bundle,LinkedHashMap<String,Resource>> getCachedResources()
      Needed by WebResource as a storage for Cache.
    • getCachedResources

      public List<Resource> getCachedResources(ResourceKeysSupplier resourceKeysSupplier)
      Batches and Sub Batches are cached and as such can't contain references to Resources, this cache helps with that.
    • getCachedConditionsEvaluation

      public Map<CachedCondition,Boolean> getCachedConditionsEvaluation()
    • getCachedConditionsParameters

      public Map<CachedCondition,DefaultUrlBuilder> getCachedConditionsParameters()
    • getSnapshot

      public Snapshot getSnapshot()
      Get all bundles.

      It is another layer of cache over the `globals.getBundles()` because it is used very heavily, to avoid any performance drawbacks of atomic reference in the `globals.getBundles()`.