Interface RequestCacheContext

All Known Implementing Classes:
DiagnosticRequestCacheContext, MapBasedRequestCacheContext, ReentrantRequestCacheContext

public interface RequestCacheContext
Represents the "request-scoped" caching context.
  • Method Details

    • getLocalMap

      @Nonnull Map<Object,Object> getLocalMap(RequestCache<?,?> requestCache)
      Returns the request-scoped storage for the given request cache. If that storage does not already exist, then one is created.
      Parameters:
      requestCache - the cache for which to locate
      Returns:
      the local storage corresponding to the given request cache
    • getLocalMapIfExists

      @Nullable Map<Object,Object> getLocalMapIfExists(RequestCache<?,?> requestCache)
      Returns the request-scoped storage for the given request cache, if it exists.
      Parameters:
      requestCache - the cache for which to locate
      Returns:
      the local storage corresponding to the given request cache, if it already exists; otherwise null.
    • clearAll

      void clearAll()
      Clears all local storage for this thread. Any request caches that belong to other threads are not affected by this.
    • clearLocalMap

      void clearLocalMap(RequestCache<?,?> requestCache)
      Clears a specific request cache's local storage for this thread. Any request caches that belong to other threads are not affected by this.
      Parameters:
      requestCache - the cache for which to clear the current thread's local storage
    • open

      void open()
      Should be called to indicate the start of the context. Can be called multiple times. Calls to this method must be paired with the same number of calls to close()
    • close

      void close()
      Should be called to indicate the attempt to stop the context. Calls to this method must be paired with the same number of calls to open()
    • markValueLoading

      void markValueLoading()
      Mark the success of adding the value to map returned by getLocalMap(RequestCache) or getLocalMapIfExists(RequestCache)