Skip to content

Comments

⚡️ [성능 향상] : 캐싱 시스템 적용#159

Merged
passionryu merged 3 commits intodevfrom
hotfix/1
Jul 26, 2025
Merged

⚡️ [성능 향상] : 캐싱 시스템 적용#159
passionryu merged 3 commits intodevfrom
hotfix/1

Conversation

@passionryu
Copy link
Collaborator

@passionryu passionryu commented Jul 26, 2025

캐싱 시스템 적용

  • 뉴스 더보기 캐싱 적용
  • 히스토리 캐싱 적용
  • 유저 세팅 캐싱 적용

Summary by CodeRabbit

  • 신규 기능

    • 뉴스 히스토리 그룹화 조회 및 사용자별 설정 캐싱 기능이 추가되었습니다.
    • 피드백 및 카카오 메시지 전송 시 관련 캐시가 자동으로 갱신됩니다.
    • 컨트롤러의 실행 시간을 로깅하는 기능이 도입되었습니다.
  • 버그 수정

    • 일부 캐시 동기화 문제를 해결하여 사용자 설정 및 피드백 반영이 신속하게 이루어집니다.
  • 리팩터링/구조 개선

    • 뉴스 히스토리 조회 로직이 별도 서비스로 분리되어 유지보수가 용이해졌습니다.
    • Redis 캐시 및 세션 구성이 명확하게 분리되었습니다.
  • 환경설정

    • 캐시 전용 Redis 서버 설정 파일이 추가되었습니다.
    • 다양한 캐시 만료 정책이 적용된 Redis 캐시 매니저가 도입되었습니다.

@passionryu passionryu merged commit 0b20159 into dev Jul 26, 2025
1 check passed
@coderabbitai
Copy link

coderabbitai bot commented Jul 26, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

이 변경사항은 Redis 기반 캐시 시스템을 도입 및 확장하고, 서비스 계층에 Spring Cache 어노테이션을 추가하여 캐시 일관성 및 성능을 개선합니다. 주요 서비스 메서드에 캐시 저장, 캐시 무효화 로직을 적용하며, Redis 캐시 매니저 및 전용 캐시 Redis 설정, AOP 기반 실행시간 로깅, 컨트롤러 및 서비스 구조 리팩토링이 포함됩니다.

Changes

파일/경로 요약 변경 내용 요약
.../Kakao/Manager/KakaoMessageManager.java, .../FeedBack/Service/FeedBackService.java 주요 메서드에 @CacheEvict 어노테이션 추가, "groupedNewsHistory" 캐시 무효화 처리, 관련 로그 및 주석 추가
.../Mypage/service/SettingService.java 사용자 설정 관련 메서드에 @Cacheable, @CacheEvict 어노테이션 추가, 캐시 키 관리 및 캐시 미스 로그 추가, 불필요한 import 제거
.../SubServices/DeprecatedCodes getGroupedNewsHistory 메서드 추가, 사용자별 뉴스 히스토리 그룹화 및 페이징 처리 로직 구현
.../SubServices/MoreNews/Controller/MoreNewsController.java HistoryService DI 및 사용, 기존 MoreNewsService의 groupedNewsHistory 관련 호출 대체, @Slf4j 추가
.../SubServices/MoreNews/Service/HistoryService.java 신규 서비스 클래스, 인증 사용자별 뉴스 히스토리 그룹화 및 페이징 제공, @Cacheable 적용, 캐시 미스 로그 추가
.../SubServices/MoreNews/Service/MoreNewsService.java groupedNewsHistory 관련 메서드 및 필드 제거, getMoreNews만 남기고 캐시 적용, 불필요한 로그 및 의존성 정리
.../Global/Aop/ExecutionTimeAspect.java 컨트롤러 메서드 실행시간 측정 AOP 클래스 추가, SLF4J 기반 로그 출력
.../Global/Config/RedisConfig.java 캐시 Redis 전용 설정 및 RedisTemplate 추가, 직렬화 설정 통합, ObjectMapper 공유, session/caching Redis 분리 명확화
.../Global/DataCachingSystem/RedisCacheManagerConfig.java Redis 캐시 매니저 설정 클래스 신설, 캐시별 TTL 및 직렬화 정책 세분화, 다양한 DTO 타입 지원
redis/redis-cache.conf 캐시 전용 Redis 설정 파일 추가, 메모리 제한 및 LRU, 영속성 비활성화 등 캐시 특화 옵션 적용

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Controller
    participant HistoryService
    participant RedisCache
    participant Repository

    Client->>Controller: getGroupedNewsHistory(page, size, auth)
    Controller->>HistoryService: getGroupedNewsHistory(page, size, auth)
    alt Cache Hit
        HistoryService->>RedisCache: Get groupedNewsHistory
        RedisCache-->>HistoryService: Return cached result
        HistoryService-->>Controller: Return cached PageResponse
    else Cache Miss
        HistoryService->>Repository: findAllByUserId
        Repository-->>HistoryService: List<History>
        HistoryService->>Repository: findAllByHistoryIdIn
        Repository-->>HistoryService: List<FeedBack>
        HistoryService->>RedisCache: Put groupedNewsHistory
        HistoryService-->>Controller: Return new PageResponse
    end
    Controller-->>Client: PageResponse<GroupedNewsHistoryResponse>
Loading
sequenceDiagram
    participant Service
    participant RedisCache

    Service->>RedisCache: @CacheEvict("groupedNewsHistory") on saveHistory/sendSingleKakaoMessage/feedback
    RedisCache-->>Service: Invalidate all groupedNewsHistory cache
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

Possibly related PRs

Suggested labels

feat

Suggested reviewers

  • daumi125
  • moonjun1
  • wjkim9

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0b8288e and abf21cd.

📒 Files selected for processing (11)
  • SpringBoot/src/main/java/Baemin/News_Deliver/Domain/Kakao/Manager/KakaoMessageManager.java (3 hunks)
  • SpringBoot/src/main/java/Baemin/News_Deliver/Domain/Mypage/service/SettingService.java (6 hunks)
  • SpringBoot/src/main/java/Baemin/News_Deliver/Domain/SubServices/DeprecatedCodes (1 hunks)
  • SpringBoot/src/main/java/Baemin/News_Deliver/Domain/SubServices/FeedBack/Service/FeedBackService.java (3 hunks)
  • SpringBoot/src/main/java/Baemin/News_Deliver/Domain/SubServices/MoreNews/Controller/MoreNewsController.java (2 hunks)
  • SpringBoot/src/main/java/Baemin/News_Deliver/Domain/SubServices/MoreNews/Service/HistoryService.java (1 hunks)
  • SpringBoot/src/main/java/Baemin/News_Deliver/Domain/SubServices/MoreNews/Service/MoreNewsService.java (4 hunks)
  • SpringBoot/src/main/java/Baemin/News_Deliver/Global/Aop/ExecutionTimeAspect.java (1 hunks)
  • SpringBoot/src/main/java/Baemin/News_Deliver/Global/Config/RedisConfig.java (3 hunks)
  • SpringBoot/src/main/java/Baemin/News_Deliver/Global/DataCachingSystem/RedisCacheManagerConfig.java (1 hunks)
  • redis/redis-cache.conf (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch hotfix/1

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant