feat: add CDN cache hit rate for accurate bandwidth cost estimation

- Add cdn_enabled and cdn_cache_hit_rate API parameters
- Use case별 기본 캐시 히트율 자동 적용 (video: 92%, blog: 90%, etc.)
- 원본 서버 트래픽(origin_monthly_tb)과 절감 비용(cdn_savings_cost) 계산
- 응답에 CDN breakdown 필드 추가 (bandwidth_estimate, bandwidth_info)
- 캐시 키에 CDN 옵션 포함하여 정확한 캐시 분리
- 4개 CDN 관련 테스트 추가 (총 59 tests)
- CLAUDE.md 문서 업데이트

Cost impact example (10K video streaming):
- Without CDN: $18,370 → With CDN 92%: $1,464 (92% savings)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
kappa
2026-01-26 11:34:53 +09:00
parent ba939ceff3
commit 23abd0e64e
8 changed files with 257 additions and 34 deletions

View File

@@ -69,6 +69,14 @@ export function generateCacheKey(req: RecommendRequest): string {
parts.push(`lang:${req.lang}`);
}
// Include CDN options in cache key
if (req.cdn_enabled !== undefined) {
parts.push(`cdn:${req.cdn_enabled}`);
}
if (req.cdn_cache_hit_rate !== undefined) {
parts.push(`cdnrate:${req.cdn_cache_hit_rate}`);
}
return `recommend:${parts.join('|')}`;
}