Skip to content

[23기_김태익] 캐싱&로깅 미션 제출합니다. - #60

Merged
Hoyoung027 merged 6 commits into
CEOS-Developers:taeik21from
taeik21:taeik21
May 18, 2026
Merged

Hoyoung027 merged 6 commits into
CEOS-Developers:taeik21from
taeik21:taeik21

Conversation

@taeik21

@taeik21 taeik21 commented May 16, 2026

Copy link
Copy Markdown

No description provided.

@shinae1023 shinae1023 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

과제하느라 수고많으셨어요!

Comment thread docker-compose.yml
ports:
- "6379:6379"
restart: unless-stopped
command: redis-server --maxmemory 1gb --maxmemory-policy allkeys-lru --appendonly yes --activedefrag yes

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docker-compose.yml에서 --maxmemory-policy allkeys-lru를 지정하여 메모리 초과 시 OOM 캐시 다운을 방지하고
--activedefrag yes 설정을 통해 캐시 삭제가 빈번할 때 발생하는 메모리 단편화 문제를 대응하신 점이 인상깊었습니다!

try {
response = paymentClient.requestInstantPayment(paymentId, paymentRequest);
} catch (Exception e) {
log.error("외부 결제 API 호출 실패 (paymentId={}): {}", paymentId, e.getMessage(), e);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

외부 API 호출 실패, 결제 금액 불일치 등 돈과 관련된 민감한 로직에 결제 ID 기대 금액, 실제 금액 등의 컨텍스트를 상세히 남겨주셨네욥 👍🏻

Comment thread README.md
- 사용자 요청이 있을 때마다, **매번 검증해야 하므로 조회 빈도 매우 빈번**
- 그때마다 별도의 외부 API로 Key 가져오면 응답 지연 및 호출 회수 초과 가능

### **2. 캐시 전략**

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

어떤 캐시 전략을 사용하셨는지 상세하게 적어주셔서 읽으며 도움이 많이 되었습니다~

@fervovita fervovita left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코드 리뷰 완료했습니다!
과제하느라 수고하셨습니다!!

Comment on lines +104 to +108
try {
paymentService.cancelPayment(paymentId);
} catch (Exception e) {
log.error("외부 결제 취소 실패 (paymentId={}): {}", paymentId, e.getMessage());
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

catch 문 안에서 로깅만 하고 있어서 payment.cancelPayment(paymentId)에서 던져진 예외가 삼켜질 것 같습니다.

throw e 등을 통해 예외를 다시 던지면 좋을 것 같아요.

Comment thread README.md
---
# 캐시 도입하기

## Redis 설정

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

캐시 설정 이유와 어떤 전략을 사용했는지 자세히 설명해주셔서 많이 배워갑니다👍

import java.util.concurrent.TimeUnit;

@Configuration
public class RedisCacheConfig {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RedissonSpringCacheManager의 기본 직렬화를 사용하고 있는 것 같습니다.
기본 직렬화를 사용하게 되면 redis에 사람이 읽을 수 없는 바이너리 값이 들어가서 추후에 디버깅이 어려워질 것 같아요.

참고하시면 좋을 것 같은 자료 첨부합니다!
https://popo-se.tistory.com/28
https://zorba91.tistory.com/352

@Hoyoung027
Hoyoung027 merged commit 6b8562a into CEOS-Developers:taeik21 May 18, 2026
1 check passed
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.

4 participants