Commit 2abb920c authored by 刘基明's avatar 刘基明

删除主题缓存

parent 55148357
......@@ -175,13 +175,14 @@ public class ThemeManager {
//附件校验
checkAttachment(req.getContent());
if (StringUtils.isEmpty(req.getEditThemeId())) {
if (StringUtils.isBlank(req.getEditThemeId())) {
// 新建
themeService.insertTheme(themeEntity);
} else {
// 修改
themeService.update(themeEntity, req.getEditThemeId());
themeEntity.setThemeId(req.getEditThemeId());
this.evictThemeCache(req.getEditThemeId());
}
// 保存附件表
List<ThemeAttachmentEntity> themeAttachments = ConvertUtil.themeReqToAttachmentList(req, themeEntity.getThemeId());
......@@ -230,13 +231,14 @@ public class ThemeManager {
.themeType(ThemeTypeEnum.FORWARD.getCode())
.build();
if (StringUtils.isEmpty(req.getEditThemeId()) || req.getEditThemeId().equals(req.getFormerThemeId())) {
if (StringUtils.isBlank(req.getEditThemeId()) || req.getEditThemeId().equals(req.getFormerThemeId())) {
// 新建
themeService.insertTheme(themeEntity);
} else {
// 修改
themeService.update(themeEntity, req.getEditThemeId());
themeEntity.setThemeId(req.getEditThemeId());
this.evictThemeCache(req.getEditThemeId());
}
try {
......@@ -537,6 +539,8 @@ public class ThemeManager {
// 逻辑删除主题,校验用户
public void delete(String themeId, String userId) {
themeService.deleteById(themeId, userId);
this.evictThemeCache(themeId);
}
......@@ -685,4 +689,9 @@ public class ThemeManager {
themeQo.setWorkshopIntroduction(userInfo.getWorkshopIntroduction());
}
private void evictThemeCache(String themeId){
redisCache.evict(StringUtils.joinWith("_", CACHE_FORMER_THEME_ID, themeId));
redisCache.evict(StringUtils.joinWith("_", CACHE_THEME_ID, themeId));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment