Package io.micronaut.cache
Interface CacheErrorHandler
-
- All Known Implementing Classes:
AsyncCacheErrorHandler,DefaultCacheErrorHandler
public interface CacheErrorHandlerAn interface for handling cache errors.
- Since:
- 1.0
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default booleanhandleInvalidateError(Cache<?> cache, java.lang.Object key, java.lang.RuntimeException e)Handles a cacheCacheInvalidateerror.default booleanhandleInvalidateError(Cache<?> cache, java.lang.RuntimeException e)Handles a cacheCacheInvalidateerror.default booleanhandleLoadError(Cache<?> cache, java.lang.Object key, java.lang.RuntimeException e)Handles an error loading a value from the cache viaCacheable.default booleanhandlePutError(Cache<?> cache, java.lang.Object key, java.lang.Object result, java.lang.RuntimeException e)Handles a cacheCachePuterror.
-
-
-
Method Detail
-
handleInvalidateError
default boolean handleInvalidateError(Cache<?> cache, java.lang.Object key, java.lang.RuntimeException e)
Handles a cacheCacheInvalidateerror. Defaults to simply rethrowing the error. By returningfalsecache invalidate errors will instead to be swallowed and ignored.- Parameters:
cache- The cachekey- The keye- The error- Returns:
- Whether the exception should be swallowed or rethrown. A value of true will rethrow he exception.
-
handleInvalidateError
default boolean handleInvalidateError(Cache<?> cache, java.lang.RuntimeException e)
Handles a cacheCacheInvalidateerror. Defaults to simply rethrowing the error. By returningfalsecache invalidate errors will instead to be swallowed and ignored.- Parameters:
cache- The cachee- The error- Returns:
- Whether the exception should be swallowed or rethrown. A value of true will rethrow he exception.
-
handlePutError
default boolean handlePutError(Cache<?> cache, java.lang.Object key, java.lang.Object result, java.lang.RuntimeException e)
Handles a cacheCachePuterror. Defaults to simply rethrowing the error. By returningfalsecache write errors will instead to be swallowed and ignored.- Parameters:
cache- The cachekey- The key nameresult- The resulte- The error- Returns:
- Whether the exception should be swallowed or rethrown. A value of true will rethrow he exception.
-
handleLoadError
default boolean handleLoadError(Cache<?> cache, java.lang.Object key, java.lang.RuntimeException e)
Handles an error loading a value from the cache viaCacheable. Note that by returningfalsethe behaviour can be customized such that cache related exceptions are ignored and the original method invoked.- Parameters:
cache- The cachekey- The keye- The error- Returns:
- Whether the exception should be swallowed or rethrown. A value of true will rethrow he exception.
-
-