Class LoggingCacheErrorHandler
java.lang.Object
org.springframework.cache.interceptor.LoggingCacheErrorHandler
- All Implemented Interfaces:
- CacheErrorHandler
A 
CacheErrorHandler implementation that logs error message. Can be
 used when underlying cache errors should be ignored.- Since:
- 5.3.16
- Author:
- Adam Ostrožlík, Stephane Nicoll
- 
Constructor SummaryConstructorsConstructorDescriptionCreate an instance that does not log stack traces.LoggingCacheErrorHandler(Log logger, boolean logStacktrace) Create an instance with theloggerto use.
- 
Method SummaryModifier 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.protected voidlogCacheError(Log logger, String message, RuntimeException ex) Log the specified message.
- 
Constructor Details- 
LoggingCacheErrorHandlerCreate an instance with theloggerto use.- Parameters:
- logger- the logger to use
- logStacktrace- whether to log stack trace
 
- 
LoggingCacheErrorHandlerpublic LoggingCacheErrorHandler()Create an instance that does not log stack traces.
 
- 
- 
Method Details- 
handleCacheGetErrorDescription 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.- Specified by:
- handleCacheGetErrorin interface- CacheErrorHandler
- Parameters:
- exception- the exception thrown by the cache provider
- cache- the cache
- key- the key used to get the item
- See Also:
 
- 
handleCachePutErrorpublic 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 interface- CacheErrorHandler
- Parameters:
- exception- the exception thrown by the cache provider
- cache- the cache
- key- the key used to update the item
- value- the value to associate with the key
- See Also:
 
- 
handleCacheEvictErrorDescription 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 interface- CacheErrorHandler
- Parameters:
- exception- the exception thrown by the cache provider
- cache- the cache
- key- the key used to clear the item
 
- 
handleCacheClearErrorDescription 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 interface- CacheErrorHandler
- Parameters:
- exception- the exception thrown by the cache provider
- cache- the cache to clear
 
- 
logCacheErrorLog the specified message.- Parameters:
- logger- the logger
- message- the message
- ex- the exception
 
 
-