2

我在两种方法上有两个缓存。brandbrands

    @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") })
4

0 回答 0