@CacheEvict:在更新數(shù)據(jù)的時候同步刪除緩存中的數(shù)據(jù)
/**
* @CacheEvict:在更新數(shù)據(jù)的時候同步刪除緩存中的數(shù)據(jù)
* @CacheEvict(value = "catagory",allEntries = true) 表示刪除catagory分區(qū)下的所有的緩存數(shù)據(jù)
* @param entity
*/
//@CacheEvict(value = "catagory",key="'getLeve1Category'")
/*@Caching(evict = {
@CacheEvict(value = "catagory",key="'getLeve1Category'")
,@CacheEvict(value = "catagory",key="'getCatelog2JSON'")
})*/
@CacheEvict(value = "catagory",allEntries = true)
@Transactional
@Override
public void updateDetail(CategoryEntity entity) {
// 更新類別名稱
this.updateById(entity);
if(!StringUtils.isEmpty(entity.getName())){
// 同步更新級聯(lián)的數(shù)據(jù)
categoryBrandRelationService.updateCatelogName(entity.getCatId(),entity.getName());
// TODO 同步更新其他的冗余數(shù)據(jù)
}
}
文章來源地址http://www.zghlxwxcb.cn/news/detail-682771.html
文章來源:http://www.zghlxwxcb.cn/news/detail-682771.html
到了這里,關(guān)于【業(yè)務(wù)功能89】補充【業(yè)務(wù)功能88】:微服務(wù)-springcloud-分布式鎖-springcache- @CacheEvict的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!