Skip to content

Commit 9f50bc3

Browse files
authored
Merge pull request #154 from team-gogo/fix/community-cache-error
[community] 올바르지 않은 key로 캐시 삭제
2 parents a018c7e + 623eaad commit 9f50bc3

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/main/kotlin/gogo/gogostage/domain/community/root/application/CommunityProcessor.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class CommunityProcessor(
2424
private val commentLikeRepository: CommentLikeRepository,
2525
private val commentMapper: CommunityMapper,
2626
private val boardRepository: BoardRepository,
27+
private val redisCacheService: RedisCacheService
2728
) {
2829

2930
fun likeBoard(studentId: Long, board: Board): LikeResDto {
@@ -89,6 +90,8 @@ class CommunityProcessor(
8990

9091
commentLikeRepository.delete(commentLike)
9192

93+
redisCacheService.deleteFromCache("${CacheConstant.COMMUNITY_INFO_CACHE_VALUE}::${comment.board.id}")
94+
9295
comment.minusLikeCount()
9396
commentRepository.save(comment)
9497

@@ -103,6 +106,8 @@ class CommunityProcessor(
103106

104107
commentLikeRepository.save(boardLike)
105108

109+
redisCacheService.deleteFromCache("${CacheConstant.COMMUNITY_INFO_CACHE_VALUE}::${comment.board.id}")
110+
106111
comment.plusLikeCount()
107112
commentRepository.save(comment)
108113

src/main/kotlin/gogo/gogostage/domain/community/root/application/CommunityServiceImpl.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ class CommunityServiceImpl(
7474
}
7575

7676
@Transactional
77-
@CacheEvict(value = [CacheConstant.COMMUNITY_INFO_CACHE_VALUE], key = "#boardId", cacheManager = "cacheManager")
7877
override fun likeBoardComment(commentId: Long): LikeResDto {
7978
val student = userUtil.getCurrentStudent()
8079
val comment = communityReader.readCommentByCommentIdForWrite(commentId)

0 commit comments

Comments
 (0)