【发布时间】:2021-04-27 09:47:20
【问题描述】:
我目前正在开发一个同时包含 Spring Data Redis 和 Spring Cache 的项目。在spring data redis中,我使用redis模板调用redis。我在 try catch 块中处理 redis 模板抛出的所有异常:
try{
// execute some operation with redis template
}
catch(RedisCommandTimeoutException ex){
}
catch(RedisBusyException ex){
}
catch(RedisConnectionFailureException ex){
}
catch(Exception ex){
}
我可以使用类似的 try-catch 块来处理来自@cacheable 的异常吗?怎么处理redis在cacheable中抛出的异常?
【问题讨论】:
标签: spring-boot redis spring-data-redis spring-cache