Commit 98b30d73 authored by 刘基明's avatar 刘基明

增加redis过期时间

parent 74fe33cb
...@@ -583,13 +583,13 @@ public class ThemeManager { ...@@ -583,13 +583,13 @@ public class ThemeManager {
private void buildThemeCountInfo(ThemeQo themeQo) { private void buildThemeCountInfo(ThemeQo themeQo) {
String themeId = themeQo.getThemeId(); String themeId = themeQo.getThemeId();
// 点赞,收藏,转发 // 点赞,收藏,转发
Integer likeCount = redisCache.getObject(StringUtils.joinWith("_", THEME_LIKE_COUNT, themeId), 60, Integer likeCount = redisCache.getObject(StringUtils.joinWith("_", THEME_LIKE_COUNT, themeId), 60 * 60 * 24,
() -> collectionService.getCountByTypeAndId(themeId, CollectionTypeEnum.LIKE_THEME), Integer.class); () -> collectionService.getCountByTypeAndId(themeId, CollectionTypeEnum.LIKE_THEME), Integer.class);
Integer commentCount = redisCache.getObject(StringUtils.joinWith("_", THEME_COMMENT_COUNT, themeId), 60, Integer commentCount = redisCache.getObject(StringUtils.joinWith("_", THEME_COMMENT_COUNT, themeId), 60 * 60 * 24,
() -> commentService.getCommentCountByThemeId(themeId), Integer.class); () -> commentService.getCommentCountByThemeId(themeId), Integer.class);
Integer forwardCount = redisCache.getObject(StringUtils.joinWith("_", THEME_FORWARD_COUNT, themeId), 60, Integer forwardCount = redisCache.getObject(StringUtils.joinWith("_", THEME_FORWARD_COUNT, themeId), 60 * 60 * 24,
() -> themeService.getForwardCountById(themeId), Integer.class); () -> themeService.getForwardCountById(themeId), Integer.class);
themeQo.setCommentCount(commentCount); themeQo.setCommentCount(commentCount);
...@@ -605,10 +605,10 @@ public class ThemeManager { ...@@ -605,10 +605,10 @@ public class ThemeManager {
Map<String, Integer> commentCountMap = commentService.getCountMapByThemeIds(themeIds); Map<String, Integer> commentCountMap = commentService.getCountMapByThemeIds(themeIds);
Map<String, Integer> forwardCountMap = themeService.getForwardCountMap(themeIds); Map<String, Integer> forwardCountMap = themeService.getForwardCountMap(themeIds);
themeQos.stream().forEach(o->{ themeQos.stream().forEach(o -> {
o.setCommentCount(commentCountMap.getOrDefault(o.getThemeId(),0)); o.setCommentCount(commentCountMap.getOrDefault(o.getThemeId(), 0));
o.setLikeCount(likeCountMap.getOrDefault(o.getThemeId(),0)); o.setLikeCount(likeCountMap.getOrDefault(o.getThemeId(), 0));
o.setForwardCount(forwardCountMap.getOrDefault(o.getThemeId(),0)); o.setForwardCount(forwardCountMap.getOrDefault(o.getThemeId(), 0));
}); });
} }
...@@ -855,13 +855,13 @@ public class ThemeManager { ...@@ -855,13 +855,13 @@ public class ThemeManager {
while (content.length() > 5000) { while (content.length() > 5000) {
b = TencentcloudUtils.textModeration(content.substring(0, 5000)); b = TencentcloudUtils.textModeration(content.substring(0, 5000));
if (StringUtils.isNotBlank(b)) { if (StringUtils.isNotBlank(b)) {
throw new BizException(ErrorCodeConstant.CONTENT_ILLEGAL.getCode(),"疑似违规词汇:"+b); throw new BizException(ErrorCodeConstant.CONTENT_ILLEGAL.getCode(), "疑似违规词汇:" + b);
} }
content = content.substring(5000); content = content.substring(5000);
} }
b = TencentcloudUtils.textModeration(content); b = TencentcloudUtils.textModeration(content);
if (StringUtils.isNotBlank(b)) { if (StringUtils.isNotBlank(b)) {
throw new BizException(ErrorCodeConstant.CONTENT_ILLEGAL.getCode(),"疑似违规词汇:"+b); throw new BizException(ErrorCodeConstant.CONTENT_ILLEGAL.getCode(), "疑似违规词汇:" + b);
} }
......
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