📰 E-commerce / Media

60-second TTL → 166 origin calls instead of 10,000

First request hits the origin and stores the response in Cloudflare KV. Every subsequent request within the 60-second TTL is served in 500µs–10ms from the nearest edge node — no origin call, no egress fees.

The Problem

""Our product catalog API is called 10,000 times per hour for the same data. Origin costs and egress fees are out of control — and response times are unpredictable.""

The Outcome

166

origin calls/hour at 10K req/h with a 60-second TTL — instead of 10,000. KV hot reads land in 500µs–10ms per Cloudflare docs.

Live demo below

The problem

Your origin is processing the same request 10,000 times a day.

"Our product catalog API is called constantly for the same data. Every call costs us compute, bandwidth, and egress fees — for data that changes once an hour."

VP Engineering, e-commerce platform

Both sides run simultaneously — real API calls, no mocks

Without Cloudflare
Every request → origin
Click "Run Demo" to see requests
With Cloudflare KV
1 miss · rest free
Click "Run Demo" to see requests

The win

30×
Faster responses
300ms → <10ms on cache hits
💸
98%
Fewer origin calls
10,000/hr → ~160 with 60s TTL
🌍
$0
Egress on hits
KV reads from nearest PoP

Productionising this

What changes when you ship this for real

Non-blocking writes

Always wrap KV writes in ctx.waitUntil(CACHE.put(...)) so the response returns immediately. The demo does this — copy the pattern.

TTL strategy

KV minimum TTL is 30s (since Jan 2026). Tune by hit pattern: 60s for hot lists, 5–15min for product detail, 1h+ for static config. Stale-while-revalidate via a second KV key + waitUntil for fresher reads.

Cache key versioning

Bump the version suffix (catalog:featured-films:v3) when the schema changes. KV is eventually-consistent — old keys stay readable while you migrate, no thundering herd.

Use Cache API for HTML

KV is for arbitrary data. For HTML/static asset responses, prefer caches.default — it's tier-1 (closer than KV) and free above the KV tier.

Origin protection

Add a circuit breaker: if origin returns >5xx in N consecutive cache-misses, serve last-known-good from KV with a stale-flag header. Prevents cache stampede during origin incidents.

Observability

Tag responses with X-Cache: HIT|MISS|STALE and watch the HIT rate via Workers Logs. Aim for >95% on hot lists.