使用 注解 @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")
})