Class SimpleCacheErrorHandler
java.lang.Object
org.springframework.cache.interceptor.SimpleCacheErrorHandler
- All Implemented Interfaces:
CacheErrorHandler
A simple
CacheErrorHandler that does not handle the
exception at all, simply throwing it back at the client.- Since:
- 4.1
- Author:
- Stephane Nicoll
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidhandleCacheClearError(RuntimeException exception, Cache cache) Handle the given runtime exception thrown by the cache provider when clearing the specifiedCache, possibly rethrowing it as a fatal exception.voidhandleCacheEvictError(RuntimeException exception, Cache cache, Object key) Handle the given runtime exception thrown by the cache provider when clearing an item with the specifiedkey, possibly rethrowing it as a fatal exception.voidhandleCacheGetError(RuntimeException exception, Cache cache, Object key) Handle the given runtime exception thrown by the cache provider when retrieving an item with the specifiedkey, possibly rethrowing it as a fatal exception.voidhandleCachePutError(RuntimeException exception, Cache cache, Object key, Object value) Handle the given runtime exception thrown by the cache provider when updating an item with the specifiedkeyandvalue, possibly rethrowing it as a fatal exception.
-
Constructor Details
-
SimpleCacheErrorHandler
public SimpleCacheErrorHandler()
-
-
Method Details
-
handleCacheGetError
Description copied from interface:CacheErrorHandlerHandle the given runtime exception thrown by the cache provider when retrieving an item with the specifiedkey, possibly rethrowing it as a fatal exception.Note that for a default
@Cacheablesetup, this will be called after an initial cache access failure, whereas the subsequent put step may independently fail and be handled inCacheErrorHandler.handleCachePutError(java.lang.RuntimeException, org.springframework.cache.Cache, java.lang.Object, java.lang.Object)still. However, for@Cacheable(sync=true), there is only a combined get step withhandleCacheGetErrorbeing called in case of failure; there won't be a separate put attempt after initial cache access failure anymore.- Specified by:
handleCacheGetErrorin interfaceCacheErrorHandler- Parameters:
exception- the exception thrown by the cache providercache- the cachekey- the key used to get the item- See Also:
-
handleCachePutError
public void handleCachePutError(RuntimeException exception, Cache cache, Object key, @Nullable Object value) Description copied from interface:CacheErrorHandlerHandle the given runtime exception thrown by the cache provider when updating an item with the specifiedkeyandvalue, possibly rethrowing it as a fatal exception.- Specified by:
handleCachePutErrorin interfaceCacheErrorHandler- Parameters:
exception- the exception thrown by the cache providercache- the cachekey- the key used to update the itemvalue- the value to associate with the key- See Also:
-
handleCacheEvictError
Description copied from interface:CacheErrorHandlerHandle the given runtime exception thrown by the cache provider when clearing an item with the specifiedkey, possibly rethrowing it as a fatal exception.- Specified by:
handleCacheEvictErrorin interfaceCacheErrorHandler- Parameters:
exception- the exception thrown by the cache providercache- the cachekey- the key used to clear the item
-
handleCacheClearError
Description copied from interface:CacheErrorHandlerHandle the given runtime exception thrown by the cache provider when clearing the specifiedCache, possibly rethrowing it as a fatal exception.- Specified by:
handleCacheClearErrorin interfaceCacheErrorHandler- Parameters:
exception- the exception thrown by the cache providercache- the cache to clear
-