Java Spring Cache:驱逐多个缓存
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25379051/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Spring Cache: Evict multiple caches
提问by
I'm using Spring Cache abstraction and I have multiple caches defined. Sometimes, when data changes, I want to evict more than one caches.
Is there away to evict multiple cache using Spring's @CacheEvict
annotation?
我正在使用 Spring Cache 抽象,并且定义了多个缓存。有时,当数据发生变化时,我想驱逐多个缓存。是否可以使用 Spring 的@CacheEvict
注释驱逐多个缓存?
采纳答案by Jaiwo99
回答by yglodt
Keep it compact: You can evict multiple caches by enumerating them inside the @CacheEvict
annotation:
保持紧凑:您可以通过在@CacheEvict
注释中枚举它们来驱逐多个缓存:
@CacheEvict(value = { "cache1", "cache2" }, allEntries = true)