From 17f8a25210598e1296c6e568c9ead4e94dd7a733 Mon Sep 17 00:00:00 2001 From: Jaewon Lee <58386334+jaewonLeeKOR@users.noreply.github.com> Date: Sat, 28 Sep 2024 21:55:35 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20#188=20=EC=A7=88=EB=AC=B8=20=EC=B4=9D?= =?UTF-8?q?=20=EA=B0=9C=EC=88=98=20=EC=A1=B0=ED=9A=8C=20=EB=A1=9C=EC=A7=81?= =?UTF-8?q?=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../capple/domain/question/service/QuestionCountService.java | 4 ++-- .../capple/domain/question/service/QuestionServiceImpl.java | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/server/capple/domain/question/service/QuestionCountService.java b/src/main/java/com/server/capple/domain/question/service/QuestionCountService.java index 8556c4b7..3d401023 100644 --- a/src/main/java/com/server/capple/domain/question/service/QuestionCountService.java +++ b/src/main/java/com/server/capple/domain/question/service/QuestionCountService.java @@ -14,13 +14,13 @@ public class QuestionCountService { private final QuestionRepository questionRepository; - @Cacheable(value = "boardCount", cacheManager = "noExpireCacheManager") + @Cacheable(value = "questionCount", cacheManager = "noExpireCacheManager") public Integer getLiveOrOldQuestionCount() { return questionRepository.getLiveOrOldQuestionCount(); } @Async - @CachePut(value = "boardCount", cacheManager = "noExpireCacheManager") + @CachePut(value = "questionCount", cacheManager = "noExpireCacheManager") public CompletableFuture updateLiveOrOldQuestionCount() { return CompletableFuture.completedFuture(questionRepository.getLiveOrOldQuestionCount()); } diff --git a/src/main/java/com/server/capple/domain/question/service/QuestionServiceImpl.java b/src/main/java/com/server/capple/domain/question/service/QuestionServiceImpl.java index bb77b3dc..c9ede3db 100644 --- a/src/main/java/com/server/capple/domain/question/service/QuestionServiceImpl.java +++ b/src/main/java/com/server/capple/domain/question/service/QuestionServiceImpl.java @@ -27,6 +27,7 @@ public class QuestionServiceImpl implements QuestionService { private final AnswerRepository answerRepository; private final QuestionMapper questionMapper; private final QuestionHeartRedisRepository questionHeartRepository; + private final QuestionCountService questionCountService; @Override public Question findQuestion(Long questionId) { @@ -49,7 +50,7 @@ public SliceResponse getQuestions(Member member, Pageable pageable Slice questionSlice = questionRepository.findAllByQuestionStatusIsLiveAndOldOrderByLivedAtDesc(member, pageable); return SliceResponse.toSliceResponse(questionSlice, questionSlice.getContent().stream() .map(questionInfoInterface -> questionMapper.toQuestionInfo(questionInfoInterface.getQuestion(), questionInfoInterface.getIsAnsweredByMember()) - ).toList(), null); + ).toList(), questionCountService.getLiveOrOldQuestionCount()); } @Override