Class AbstractCacheInvoker
java.lang.Object
org.springframework.cache.interceptor.AbstractCacheInvoker
- Direct Known Subclasses:
- CacheAspectSupport,- JCacheAspectSupport
A base component for invoking 
Cache operations and using a
 configurable CacheErrorHandler when an exception occurs.- Since:
- 4.1
- Author:
- Stephane Nicoll, Juergen Hoeller, Simon Baslé
- See Also:
- 
Field SummaryFields
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedprotectedAbstractCacheInvoker(CacheErrorHandler errorHandler) 
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidExecuteCache.clear()on the specifiedCacheand invoke the error handler if an exception occurs.protected voidExecuteCache.evict(Object)/Cache.evictIfPresent(Object)on the specifiedCacheand invoke the error handler if an exception occurs.protected Cache.ValueWrapperExecuteCache.get(Object)on the specifiedCacheand invoke the error handler if an exception occurs.protected <T> TExecuteCache.get(Object, Callable)on the specifiedCacheand invoke the error handler if an exception occurs.protected voidExecuteCache.put(Object, Object)on the specifiedCacheand invoke the error handler if an exception occurs.protected CompletableFuture<?>doRetrieve(Cache cache, Object key) ExecuteCache.retrieve(Object)on the specifiedCacheand invoke the error handler if an exception occurs.protected <T> CompletableFuture<T>doRetrieve(Cache cache, Object key, Supplier<CompletableFuture<T>> valueLoader) ExecuteCache.retrieve(Object, Supplier)on the specifiedCacheand invoke the error handler if an exception occurs.Return theCacheErrorHandlerto use.voidsetErrorHandler(CacheErrorHandler errorHandler) Set theCacheErrorHandlerinstance to use to handle errors thrown by the cache provider.
- 
Field Details- 
errorHandler
 
- 
- 
Constructor Details- 
AbstractCacheInvokerprotected AbstractCacheInvoker()
- 
AbstractCacheInvoker
 
- 
- 
Method Details- 
setErrorHandlerSet theCacheErrorHandlerinstance to use to handle errors thrown by the cache provider. By default, aSimpleCacheErrorHandleris used who throws any exception as is.
- 
getErrorHandlerReturn theCacheErrorHandlerto use.
- 
doGetExecuteCache.get(Object)on the specifiedCacheand invoke the error handler if an exception occurs. Returnnullif the handler does not throw any exception, which simulates a cache miss in case of error.- See Also:
 
- 
doGetExecuteCache.get(Object, Callable)on the specifiedCacheand invoke the error handler if an exception occurs. Invokes thevalueLoaderif the handler does not throw any exception, which simulates a cache read-through in case of error.- Since:
- 6.2
- See Also:
 
- 
doRetrieveExecuteCache.retrieve(Object)on the specifiedCacheand invoke the error handler if an exception occurs. Returnsnullif the handler does not throw any exception, which simulates a cache miss in case of error.- Since:
- 6.2
- See Also:
 
- 
doRetrieveprotected <T> CompletableFuture<T> doRetrieve(Cache cache, Object key, Supplier<CompletableFuture<T>> valueLoader) ExecuteCache.retrieve(Object, Supplier)on the specifiedCacheand invoke the error handler if an exception occurs. Invokes thevalueLoaderif the handler does not throw any exception, which simulates a cache read-through in case of error.- Since:
- 6.2
- See Also:
 
- 
doPutExecuteCache.put(Object, Object)on the specifiedCacheand invoke the error handler if an exception occurs.
- 
doEvictExecuteCache.evict(Object)/Cache.evictIfPresent(Object)on the specifiedCacheand invoke the error handler if an exception occurs.
- 
doClearExecuteCache.clear()on the specifiedCacheand invoke the error handler if an exception occurs.
 
-