Cache vs CDN — What's the Difference?
A cache stores a copy of data somewhere to avoid recomputing or refetching it; a CDN is a specific, geographically distributed network of caching servers pos...
Published November 24, 2026
A cache is any temporary storage that keeps data close for faster reuse (browser, server memory, Redis); a CDN is a specific kind of cache: a geographically distributed network of servers that caches your content near users worldwide.
The concept
Caches exist at many layers: browser cache, CDN edge, reverse proxy, application cache and database cache. Each avoids redoing work further down.
A CDN mainly reduces latency for static assets and absorbs traffic, while an application cache like Redis avoids repeated expensive computations or queries.
Layers of caching
Practical examples
HTTP caching headers
Cache-Control: public, max-age=3600
ETag: "abc123"Application cache with Redis
let data = await redis.get(key)
if (!data) { data = await db.query(); await redis.set(key, JSON.stringify(data), 'EX', 300) }Purge the CDN after deploy
# invalidate changed paths via your CDN's API or dashboardCommon mistakes
- Caching personalised data in shared caches.
- No invalidation strategy.
- Long TTLs on files without fingerprinted names.
Key takeaways
- Cache = any fast temporary store.
- CDN = distributed cache at the edge.
- Use several layers with clear invalidation.
FAQ
Do I need both?
Most production sites use a CDN plus application caching.
What is cache invalidation?
Removing or refreshing stale cached data.