diff --git a/src/main/java/org/guzzing/studayserver/domain/academy/service/AcademyService.java b/src/main/java/org/guzzing/studayserver/domain/academy/service/AcademyService.java index 88a36c37..f4da88d5 100644 --- a/src/main/java/org/guzzing/studayserver/domain/academy/service/AcademyService.java +++ b/src/main/java/org/guzzing/studayserver/domain/academy/service/AcademyService.java @@ -79,6 +79,7 @@ public AcademiesByLocationWithScrollResults findAcademiesByLocationWithScroll( } @Transactional(readOnly = true) + @Cacheable(cacheNames = "academyByLocation") public AcademyByLocationWithCursorResults findAcademiesByLocationWithCursor( AcademyByLocationWithCursorParam param) { String diagonal = GeometryUtil.makeDiagonal(param.baseLatitude(), param.baseLongitude(), DISTANCE); diff --git a/src/main/java/org/guzzing/studayserver/domain/like/service/LikeCommandService.java b/src/main/java/org/guzzing/studayserver/domain/like/service/LikeCommandService.java index 1c0e5e11..c786ca8c 100644 --- a/src/main/java/org/guzzing/studayserver/domain/like/service/LikeCommandService.java +++ b/src/main/java/org/guzzing/studayserver/domain/like/service/LikeCommandService.java @@ -4,6 +4,9 @@ import org.guzzing.studayserver.domain.like.model.Like; import org.guzzing.studayserver.domain.like.repository.LikeRepository; import org.guzzing.studayserver.domain.member.model.Member; +import org.guzzing.studayserver.global.config.CaffeineCacheType; +import org.springframework.boot.autoconfigure.cache.CacheType; +import org.springframework.cache.annotation.CacheEvict; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -17,11 +20,13 @@ public LikeCommandService(final LikeRepository likeRepository) { this.likeRepository = likeRepository; } + @CacheEvict(value = "academyByLocation") public Like saveLike(final Member member, final Academy academy) { final Like like = Like.of(member, academy); return likeRepository.save(like); } + @CacheEvict(value = "academyByLocation") public void deleteLike(final long likeId) { likeRepository.deleteById(likeId); }