Skip to content

[DP-387] 트렌드 Redis 캐시 무효화 Internal API#134

Merged
suheon98 merged 4 commits intodevelopV2from
fix/DP-387-trend-cache-eviction
Apr 24, 2026
Merged

[DP-387] 트렌드 Redis 캐시 무효화 Internal API#134
suheon98 merged 4 commits intodevelopV2from
fix/DP-387-trend-cache-eviction

Conversation

@suheon98
Copy link
Copy Markdown
Collaborator

Summary

  • AI 서버가 새 트렌드 분석 결과를 INSERT한 직후 BE에 캐시 무효화 요청을 보낼 수 있도록 Internal API 추가
  • DELETE /internal/trends/cacheX-Internal-Key 헤더 인증, APP_TREND_CACHE_EVICT_KEY 환경변수로 키 설정
  • periodStart 없으면 :latest 키만 삭제, 있으면 :latest + 해당 기간 키 함께 삭제

Changes

파일 변경
TrendAnalysisService evictCache(unit, scope, periodStart) 메서드 추가
InternalTrendCacheController DELETE /internal/trends/cache 엔드포인트 신규
SecurityConfig /internal/trends/cache DELETE permitAll 추가

AI 서버 연동 스펙

DELETE /internal/trends/cache
Headers: X-Internal-Key: {APP_TREND_CACHE_EVICT_KEY}
Params:
  - unit        (default: weekly)
  - scope       (default: global)
  - periodStart (optional, yyyy-MM-dd) — latest + 특정 기간 키 동시 삭제
Response: 204 No Content

Test plan

  • InternalTrendCacheControllerTest — 5케이스 (키 정상/불일치/없음/미설정, periodStart 유무)
  • ./gradlew build --no-daemon 통과

Jira: https://devpick.atlassian.net/browse/DP-387

@sonarqubecloud
Copy link
Copy Markdown

@suheon98 suheon98 merged commit 9970a8a into developV2 Apr 24, 2026
4 checks 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.

1 participant