[DP-387] 트렌드 배치 완료 후 BE Redis 캐시 무효화 연동#59
Merged
Conversation
- CacheEvictionClient: DELETE /internal/trends/cache 호출, best-effort (실패 시 warning 로그만) - TrendOrchestrator: backend_url + cache_evict_key 파라미터 추가, upsert 직후 evict() 호출 - run_trend_batch.py / run_trend_scheduler.py: BACKEND_URL + TREND_CACHE_EVICT_KEY 환경변수 주입 - .env.example: TREND_CACHE_EVICT_KEY 항목 추가 - 테스트: CacheEvictionClient 8개, 오케스트레이터 통합 5개 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…DP-387) 캐시 무효화 헤더(X-Internal-Key)가 기존 내부 API 인증 키와 동일하므로 별도 환경변수 불필요. cache_evict_key → internal_key 파라미터로 통일. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DELETE /internal/trends/cache를 호출해 Redis 캐시를 즉시 무효화CacheEvictionClientbest-effort 설계 — 캐시 무효화 실패가 배치 전체 실패로 전파되지 않음Changes
app/services/trend/cache_eviction.py(신규) —CacheEvictionClient:requests.delete기반, 실패 시 warning 로그만app/services/trend/orchestrator.py—backend_url+cache_evict_key파라미터 추가,upsert()직후evict()호출scripts/run_trend_batch.py/run_trend_scheduler.py—BACKEND_URL+TREND_CACHE_EVICT_KEY환경변수 읽어 오케스트레이터에 주입.env.example—TREND_CACHE_EVICT_KEY항목 추가환경변수 설정 필요
미설정 시 캐시 무효화 skip — 기존 동작(TTL 만료 후 갱신) 유지
Test plan
CacheEvictionClient단위 테스트 8개 (성공/비204/네트워크 오류/타임아웃)TrendOrchestrator캐시 통합 테스트 5개 (클라이언트 생성 조건, upsert 후 evict 호출 검증)🤖 Generated with Claude Code