@CacheEvict:在更新数据的时候同步删除缓存中的数据
/**
* @CacheEvict:在更新数据的时候同步删除缓存中的数据
* @CacheEvict(value = "catagory",allEntries = true) 表示删除catagory分区下的所有的缓存数据
* @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())){
// 同步更新级联的数据
categoryBrandRelationService.updateCatelogName(entity.getCatId(),entity.getName());
// TODO 同步更新其他的冗余数据
}
}