如何通过cacheNames退出Spring缓存?

时间:2018-07-05 02:19:37

标签: java spring-boot spring-cache

在我的应用中,我必须像这样拖曳缓存:

@Cacheable(cacheNames = "user", key= "#userId")
public User queryUserDetail(Long userId) {
    ......
}
@Cacheable(cacheNames = "address", key= "#addressId")
public Address queryAddressDetail(Long addressId) {
    ......
}

如果cacheNames是“ user”,我想清除所有缓存:

@CacheEvict(cacheNames = "user", allEntries = true)
public void clearAllUserCache() {}

但它也清除了带有cacheNames“ address”的缓存,

我该如何使用cacheNames“ user”清除缓存

0 个答案:

没有答案