Skip to content

Fix: Api 인증 필터에서 가맹점 정보 (api_credentials) 캐싱 기능 #18

@JaesungGo

Description

@JaesungGo

🧐 기능 소개

API 인증 필터에서 매 요청 발생하는 DB 조회를 캐싱으로 최적화 하여 응답 시간을 단축시키고, DB 부하를 줄여보려고 합니다.

// ApiAuthenticationFilter.java
ApiCredentialResponse credential =
    apiCredentialService.findByClientId(clientId);
if (credential == null || !ApiStatus.ACTIVE.equals(credential.getStatus())) {
    throw new ApiException.ApiAuthenticationException("Invalid API credential");
}

선택 근거

  1. PG 특성 상 가맹점 수가 제한적이므로 캐시 용량 부담이 적을 것이라고 예상했습니다.
  2. 동일 가맹점의 결제 요청이 빈번하기 때문에 높은 캐시 히트율을 통해 확실한 개선효과가 기대됩니다.

🔗 연관된 이슈

🔧 작업 예정 내용

  • Spring Cache + Caffeine 설정 추가
  • 캐시 TTL 설정 및 크기 제한 구현
  • 캐시 웜업 및 스케줄링 기능 구현
  • 가맹점 정보 변경 시 캐시 무효화 기능 추가

📆 예상 기간

2025.07.04 ~ 2025.07.04

📝 추가 정보

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status

    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions