Caching stores a copy of data in a faster or closer store so repeated requests can be served without recomputing or hitting the primary source (DB, API). It reduces latency and load on the source.
| Layer | Where | Typical use |
|---|---|---|
| Browser | Client | Static assets, HTTP cache headers |
| CDN / Edge | Edge POPs | Static files, API response cache |
| Application | In-process or local | Hot data, computed results |
| Distributed cache | Redis, Memcached | Shared cache across app servers |
| DB layer | Query cache, buffer pool | DB’s own optimization |
Cache where it gives the most benefit: close to the client for latency (CDN, browser), close to the app for throughput (Redis). Invalidate or set TTL when data can change.