🚀 Cloudflare Cache Test

Edge Cache / Cache API / cf Override の動作比較検証ツール

Worker: cache-test.taka-cloudflare.win
compatibility_date: 2025-04-02

テストパターン

1. Edge Cache

fetch() 経由 - Cache Rules が適用される

Cache Rules ✓ Tiered Cache ✓

2. Cache API

caches.default 直接 - Cache Rules 適用外

Cache Rules ✗ Tiered Cache ✗

3. cf Override

fetch({ cf }) で Cache Rules を上書き

Cache Rules 上書き Tiered Cache ✓

4. Hybrid

fetch(cf) + cache.put() の組み合わせ

部分適用 部分対応

5. Hono Middleware

Hono cache() ミドルウェア使用

Cache Rules ✗ Tiered Cache ✗

パターン比較表

エンドポイント 方式 Cache Rules Tiered Cache TTL制御
/api/edge fetch() ✅ 適用 ✅ 対応 Cache Rules / オリジン
/api/cacheapi caches.default ❌ 適用外 ❌ 非対応 コード内で指定
/api/override fetch({ cf }) ⚠️ 上書き ✅ 対応 cf オブジェクト
/api/hybrid fetch + put() ⚠️ 部分的 ⚠️ 部分的 両方で制御
/api/middleware Hono cache() ❌ 適用外 ❌ 非対応 ミドルウェア設定

確認ポイント

レスポンスヘッダー

CF-Cache-StatusHIT / MISS / DYNAMIC / BYPASS / EXPIRED
Ageキャッシュからの経過秒数
X-Cache-StatusWorker側で付与したステータス