From 3f80b4735936f5e2987b9ef3934efb02810db464 Mon Sep 17 00:00:00 2001 From: byeolhaha Date: Fri, 23 Feb 2024 21:31:56 +0900 Subject: [PATCH] =?UTF-8?q?refactor=20:=20=EC=BB=A4=EA=B1=B0=20=EC=8B=9C?= =?UTF-8?q?=EB=B0=98=20=ED=95=99=EC=9B=90=20=EB=AA=A9=EB=A1=9D=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=202=EC=B0=A8=20=EC=BA=90=EC=8B=9C=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../studayserver/domain/academy/service/AcademyService.java | 1 + .../studayserver/domain/like/service/LikeCommandService.java | 5 +++++ 2 files changed, 6 insertions(+) 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); }