@@ -6,7 +6,10 @@ import gogo.gogostage.domain.community.root.application.dto.*
66import gogo.gogostage.domain.community.root.persistence.SortType
77import gogo.gogostage.domain.game.persistence.GameCategory
88import gogo.gogostage.domain.stage.root.application.StageValidator
9+ import gogo.gogostage.global.cache.CacheConstant
910import gogo.gogostage.global.util.UserContextUtil
11+ import org.springframework.cache.annotation.CacheEvict
12+ import org.springframework.cache.annotation.Cacheable
1013import org.springframework.stereotype.Service
1114import org.springframework.transaction.annotation.Transactional
1215
@@ -41,6 +44,7 @@ class CommunityServiceImpl(
4144 }
4245
4346 @Transactional(readOnly = true )
47+ @Cacheable(value = [CacheConstant .COMMUNITY_INFO_CACHE_VALUE ], key = " #boardId" , cacheManager = " cacheManager" )
4448 override fun getStageBoardInfo (boardId : Long ): GetCommunityBoardInfoResDto {
4549 val student = userUtil.getCurrentStudent()
4650 val board = boardReader.read(boardId)
@@ -51,6 +55,7 @@ class CommunityServiceImpl(
5155 }
5256
5357 @Transactional
58+ @CacheEvict(value = [CacheConstant .COMMUNITY_INFO_CACHE_VALUE ], key = " #boardId" , cacheManager = " cacheManager" )
5459 override fun likeStageBoard (boardId : Long ): LikeResDto {
5560 val student = userUtil.getCurrentStudent()
5661 val board = communityReader.readBoardByBoardIdForWrite(boardId)
@@ -59,6 +64,7 @@ class CommunityServiceImpl(
5964 }
6065
6166 @Transactional
67+ @CacheEvict(value = [CacheConstant .COMMUNITY_INFO_CACHE_VALUE ], key = " #boardId" , cacheManager = " cacheManager" )
6268 override fun writeBoardComment (boardId : Long , writeBoardCommentDto : WriteBoardCommentReqDto ): WriteBoardCommentResDto {
6369 val student = userUtil.getCurrentStudent()
6470 val board = communityReader.readBoardByBoardId(boardId)
@@ -68,6 +74,7 @@ class CommunityServiceImpl(
6874 }
6975
7076 @Transactional
77+ @CacheEvict(value = [CacheConstant .COMMUNITY_INFO_CACHE_VALUE ], key = " #boardId" , cacheManager = " cacheManager" )
7178 override fun likeBoardComment (commentId : Long ): LikeResDto {
7279 val student = userUtil.getCurrentStudent()
7380 val comment = communityReader.readCommentByCommentIdForWrite(commentId)
0 commit comments