我在两种方法上有两个缓存。brand
和brands
@CacheEvict(value ={ "brand" }, key = "#brand.brandId")
public Brand createOrUpdateBrand(final Brand brand){
}
@Cacheable("brands")
public Set<String> getAllBrandNames()
{
}
现在我想从被调用brands
时驱逐一切。createOrUpdateBrand
我可以做类似以下的事情吗???
@CacheEvict(value ={ "brand" }, key = "#brand.brandId")
@CacheEvict("brands")
public Brand createOrUpdateBrand(final Brand brand){
}
或者
@Caching(evict = { @CacheEvict("brands"), @CacheEvict(value = "brand", key = "#brand.brandId") })