Skip to content
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

Spring Data Respository를 사용한 Redis 캐싱 수행시 Hikaricp Conneciton을 사용하는 문제 해결 #191

Merged
merged 3 commits into from
Jul 27, 2024

Conversation

JadeKim042386
Copy link
Member

@JadeKim042386 JadeKim042386 commented Jul 27, 2024

🔍️ 이 PR을 통해 해결하려는 문제

✨ 이 PR에서 핵심적으로 변경된 사항

  • RedisConfig 수정

    • RedisCacheManager를 적용: TTL을 1일로 설정하고 id와 유저 정보를 각각 key와 value로 설정했습니다. 이때 value는 JSON 형식으로 저장합니다.
    • @Cahceable, @CacheEvict 어노테이션을 사용하여 캐시를 저장/삭제합니다.
  • MemberPrincipal에 UserRole 필드를 추가하여 authorities 대신 캐싱되도록 반영했습니다.

  • 적용 결과: 상세 게시글 조회 요청을 100회 수행했을 때 304 -> 205개로 Hikaricp Connection을 얻는 횟수가 줄어들었습니다.

image

🔖 핵심 변경 사항 외에 추가적으로 변경된 부분

  • 없음

📌 PR 진행 시 이러한 점들을 참고해 주세요

  • Reviewer 분들은 코드 리뷰 시 좋은 코드의 방향을 제시하되, 코드 수정을 강제하지 말아 주세요.
  • Reviewer 분들은 좋은 코드를 발견한 경우, 칭찬과 격려를 아끼지 말아 주세요.
  • Review는 특수한 케이스가 아니면 Reviewer로 지정된 시점 기준으로 1일 이내에 진행해 주세요.

Issue Tags

- TTL을 1일로 설정하고 id와 유저 정보를 각각 key와 value로 설정
- MemberPrincipal에 UserRole 필드를 추가하여 authorities 대신 캐싱되도록 반영
- 변경점 모두 수정
@JadeKim042386 JadeKim042386 added the enhancement New feature or request label Jul 27, 2024
@JadeKim042386 JadeKim042386 self-assigned this Jul 27, 2024
- 유저 정보 캐싱 코드를 수정하면서 변경된 부분에 대한 테스트 코드를 수정
Copy link

codecov bot commented Jul 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Files Coverage Δ Complexity Δ
...reshtrashbackend/controller/AuctionController.java 100.00% <100.00%> (ø) 7.00 <1.00> (ø)
...reshtrashbackend/controller/ProductController.java 100.00% <100.00%> (ø) 6.00 <0.00> (ø)
...trash/freshtrashbackend/service/MemberService.java 90.19% <100.00%> (-0.88%) 16.00 <2.00> (ø)
...rash/freshtrashbackend/service/ProductService.java 93.33% <100.00%> (ø) 10.00 <2.00> (ø)

@JadeKim042386 JadeKim042386 merged commit 4b71835 into develop Jul 27, 2024
2 checks passed
@JadeKim042386 JadeKim042386 deleted the feature/#190-refactor-user-caching branch July 27, 2024 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spring Data Respository를 사용한 Redis 캐싱 수행시 Hikaricp Conneciton을 사용하는 문제
1 participant