Spring Boot 更新、清除多个缓存

使用 注解 @Caching ,源码如下

@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
public @interface Caching {
    Cacheable[] cacheable() default {};

    CachePut[] put() default {};

    CacheEvict[] evict() default {};
}
//更新多个
@Caching(put = {
     @CachePut(value = "user",key = "#key"),
     @CachePut(value = "user",key = "#key2")
})
//删除多个
@Caching(evict = {
     @CacheEvict(value = "user",key = "#key"),
     @CacheEvict(value = "user",key = "#key2")
})

 

相关推荐
©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页