-
Notifications
You must be signed in to change notification settings - Fork 0
✨ Fix: Redis 캐시 적용 및 게시글 목록 역직렬화 오류 해결 #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8a77b75
:sparkles:Feat: Redis 캐시 도입을 위한 도커 컴포즈 파일 설정 및 서브모듈 변경
d39286e
:sparkles:Feat: 체육시설 조회 Redis 캐시 적용
f6fbf68
:wrench: Settings: be-config 서브모듈 포인터 업데이트
a3cc44f
:sparkles:Feat: Post 엔티티 캐시 적용 & Page DTO 리팩토링
fd256ba
:wrench: Settings: 서브모듈 포인터 업데이트
a8c9a95
:bug: Fix: Redis 캐시 postList 역직렬화 타입 이슈 해결
8e9407c
Merge branch 'develop' into feat/redis
angoroa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/main/java/com/be/sportizebe/domain/facility/dto/CacheKeyProvider.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| package com.be.sportizebe.domain.facility.dto; | ||
|
|
||
| public interface CacheKeyProvider { | ||
| String generateCacheKey(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/main/java/com/be/sportizebe/domain/facility/service/SportsFacilityServiceImpl.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| package com.be.sportizebe.domain.facility.service; | ||
|
|
||
| import com.be.sportizebe.domain.facility.dto.request.FacilityMarkerRequest; | ||
| import com.be.sportizebe.domain.facility.dto.request.FacilityNearRequest; | ||
| import com.be.sportizebe.domain.facility.dto.response.FacilityMarkerResponse; | ||
| import com.be.sportizebe.domain.facility.dto.response.FacilityNearResponse; | ||
| import com.be.sportizebe.domain.facility.mapper.FacilityMapper; | ||
| import com.be.sportizebe.domain.facility.repository.SportsFacilityRepository; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.cache.annotation.Cacheable; | ||
| import org.springframework.stereotype.Service; | ||
| import org.springframework.transaction.annotation.Transactional; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @Service | ||
| @RequiredArgsConstructor | ||
| @Transactional(readOnly = true) | ||
| public class SportsFacilityServiceImpl implements SportsFacilityService { | ||
|
|
||
| private final SportsFacilityRepository sportsFacilityRepository; | ||
|
|
||
| @Override | ||
| @Cacheable( | ||
| cacheNames = "facilityNear", | ||
| key = "#root.args[0].generateCacheKey()" | ||
| ) | ||
| public List<FacilityNearResponse> getNear(FacilityNearRequest request) { | ||
| String type = (request.getType() == null) ? null : request.getType().name(); | ||
|
|
||
| return sportsFacilityRepository.findNear( | ||
| request.getLat(), | ||
| request.getLng(), | ||
| request.getRadiusM(), | ||
| request.getLimit(), | ||
| type | ||
| ).stream() | ||
| .map(FacilityMapper::toNearResponse) | ||
| .toList(); | ||
| } | ||
|
|
||
| @Override | ||
| @Cacheable( | ||
| cacheNames = "facilityMarkers", | ||
| key = "#root.args[0].generateCacheKey()" | ||
| ) | ||
| public List<FacilityMarkerResponse> getMarkers(FacilityMarkerRequest request) { | ||
| String type = (request.getType() == null) ? null : request.getType().name(); | ||
|
|
||
| return sportsFacilityRepository.findMarkersNear( | ||
| request.getLat(), | ||
| request.getLng(), | ||
| request.getRadiusM(), | ||
| request.getLimit(), | ||
| type | ||
| ).stream() | ||
| .map(FacilityMapper::toMarkerResponse) | ||
| .toList(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/com/be/sportizebe/domain/post/dto/response/PageInfoResponse.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| package com.be.sportizebe.domain.post.dto.response; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
|
|
||
| @Schema(description = "페이지 정보") | ||
| public record PageInfoResponse( | ||
| @Schema(description = "현재 페이지 (0부터 시작)", example = "0") | ||
| int page, | ||
|
|
||
| @Schema(description = "페이지 크기", example = "10") | ||
| int size, | ||
|
|
||
| @Schema(description = "전체 요소 수", example = "123") | ||
| long totalElements, | ||
|
|
||
| @Schema(description = "전체 페이지 수", example = "13") | ||
| int totalPages, | ||
|
|
||
| @Schema(description = "다음 페이지 존재 여부", example = "true") | ||
| boolean hasNext | ||
| ) {} |
33 changes: 33 additions & 0 deletions
33
src/main/java/com/be/sportizebe/domain/post/dto/response/PostPageResponse.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| package com.be.sportizebe.domain.post.dto.response; | ||
|
|
||
| import com.be.sportizebe.domain.post.entity.Post; | ||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import org.springframework.data.domain.Page; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @Schema(title = "PostPageResponse", description = "게시글 목록 + 페이지 정보 응답") | ||
| public record PostPageResponse( | ||
|
|
||
| @Schema(description = "게시글 목록") | ||
| List<PostResponse> content, | ||
|
|
||
| @Schema(description = "페이지 정보") | ||
| PageInfoResponse pageInfo | ||
|
|
||
| ) { | ||
| public static PostPageResponse from(Page<Post> page) { | ||
| return new PostPageResponse( | ||
| page.getContent().stream() | ||
| .map(PostResponse::from) | ||
| .toList(), | ||
| new PageInfoResponse( | ||
| page.getNumber(), | ||
| page.getSize(), | ||
| page.getTotalElements(), | ||
| page.getTotalPages(), | ||
| page.hasNext() | ||
| ) | ||
| ); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
주석 오탈자 수정 제안(“조히” → “조회”).
✍️ 수정 제안
📝 Committable suggestion
🤖 Prompt for AI Agents