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

增加redis过期时间

parent 74fe33cb
......@@ -583,13 +583,13 @@ public class ThemeManager {
private void buildThemeCountInfo(ThemeQo themeQo) {
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);
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);
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);
themeQo.setCommentCount(commentCount);
......@@ -605,10 +605,10 @@ public class ThemeManager {
Map<String, Integer> commentCountMap = commentService.getCountMapByThemeIds(themeIds);
Map<String, Integer> forwardCountMap = themeService.getForwardCountMap(themeIds);
themeQos.stream().forEach(o->{
o.setCommentCount(commentCountMap.getOrDefault(o.getThemeId(),0));
o.setLikeCount(likeCountMap.getOrDefault(o.getThemeId(),0));
o.setForwardCount(forwardCountMap.getOrDefault(o.getThemeId(),0));
themeQos.stream().forEach(o -> {
o.setCommentCount(commentCountMap.getOrDefault(o.getThemeId(), 0));
o.setLikeCount(likeCountMap.getOrDefault(o.getThemeId(), 0));
o.setForwardCount(forwardCountMap.getOrDefault(o.getThemeId(), 0));
});
}
......@@ -855,13 +855,13 @@ public class ThemeManager {
while (content.length() > 5000) {
b = TencentcloudUtils.textModeration(content.substring(0, 5000));
if (StringUtils.isNotBlank(b)) {
throw new BizException(ErrorCodeConstant.CONTENT_ILLEGAL.getCode(),"疑似违规词汇:"+b);
throw new BizException(ErrorCodeConstant.CONTENT_ILLEGAL.getCode(), "疑似违规词汇:" + b);
}
content = content.substring(5000);
}
b = TencentcloudUtils.textModeration(content);
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