Skip to content

Commit

Permalink
[BE] Post Vote 발생시 post 캐시 초기화 되도록 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
Jinwook94 committed Nov 7, 2023
1 parent df4555f commit 2cd72c5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Expand Up @@ -254,4 +254,7 @@ private void updateVoteStatusForPost(boolean isLogin, Long memberId, PostRespons
}
}

@CacheEvict(value = "posts", allEntries = true)
public void cacheEvict() {}

}
Expand Up @@ -72,6 +72,8 @@ public VotableResponse vote(AuthInfo authInfo, VoteRequest request) {
PostDocument postDocumentFromPost = PostDocument.fromPost(post);
postDocumentFromPost.setId(postDocumentByPostId.getId());
postElasticsearchRepository.modifyPost(postDocumentFromPost);

postService.cacheEvict();
return PostDetailResponse.fromPost(post, isBookmarked);
}
case POST_COMMENT -> {
Expand Down

0 comments on commit 2cd72c5

Please sign in to comment.