Interface RequestCacheContext
- All Known Implementing Classes:
DiagnosticRequestCacheContext
,MapBasedRequestCacheContext
,ReentrantRequestCacheContext
public interface RequestCacheContext
Represents the "request-scoped" caching context.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clearAll()
Clears all local storage for this thread.void
clearLocalMap
(RequestCache<?, ?> requestCache) Clears a specific request cache's local storage for this thread.void
close()
Should be called to indicate the attempt to stop the context.getLocalMap
(RequestCache<?, ?> requestCache) Returns the request-scoped storage for the given request cache.getLocalMapIfExists
(RequestCache<?, ?> requestCache) Returns the request-scoped storage for the given request cache, if it exists.void
Mark the success of adding the value to map returned bygetLocalMap(RequestCache)
orgetLocalMapIfExists(RequestCache)
void
open()
Should be called to indicate the start of the context.
-
Method Details
-
getLocalMap
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
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
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 toclose()
-
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 toopen()
-
markValueLoading
void markValueLoading()Mark the success of adding the value to map returned bygetLocalMap(RequestCache)
orgetLocalMapIfExists(RequestCache)
-