Skip to content

Commit

Permalink
refactor : 커거 시반 학원 목록 조회 2차 캐시 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
byeolhaha committed Feb 23, 2024
1 parent 35633fb commit 3f80b47
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
}
Expand Down

0 comments on commit 3f80b47

Please sign in to comment.