Skip to content

Commit

Permalink
Merge pull request #184 from prgrms-web-devcourse-final-project/fix/#183
Browse files Browse the repository at this point in the history
-reply-redis

fix: #183 ๋‹ต์žฅ ํŽธ์ง€ ๋ ˆ๋””์Šค์— ์ค‘๋ณตํ•ด์„œ ์ €์žฅ๋˜๋Š” ๋ฌธ์ œ ํ•ด๊ฒฐ
  • Loading branch information
kahyun0255 authored Dec 9, 2024
2 parents 2e8478d + 5566c85 commit 37bce88
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,14 @@ public void fetchRecentReply(Long userId, int fetchItemSize) {
List<ReplyProjectDTO> reversedList = new ArrayList<>(recentMapKeywordReplyByUserId);
Collections.reverse(reversedList);

List<Object> existingValues = redisTemplate.opsForList().range(key, 0, -1);

for (ReplyProjectDTO replyLetter : reversedList) {
String tempValue = replyLetter.getType() + ":" + replyLetter.getId() + ":" + replyLetter.getLabel();
redisTemplate.opsForList().leftPush(key, tempValue);

if (existingValues == null || !existingValues.contains(tempValue)) { //๋ ˆ๋””์Šค์— ์—†์„ ๋•Œ๋งŒ ์ €์žฅ
redisTemplate.opsForList().leftPush(key, tempValue);
}
}
}

Expand Down

0 comments on commit 37bce88

Please sign in to comment.