Benefits of Caching
| Caching benefit | Why it helps |
|---|---|
| Speed | Cache access is far faster than secondary storage access |
| Efficiency | Reuses frequent data instead of repeatedly fetching from slow storage |
| Reduced load | Lowers pressure on databases/disks and network resources |
Drawbacks of Caching
| Caching drawback | Why it is a problem |
|---|---|
| Cache size limits | Small caches cannot hold all useful data; very large caches add lookup overhead |
| Implementation complexity | Cache policies/prefetching are hard to tune correctly |
| Data consistency risk | Cached data can become stale if source data changes |
| Cache misses | Misses force slow fallback to main/secondary storage |
| Step | What happens |
|---|---|
| 1 | User visits www.example.com |
| 2 | Browser downloads HTML/CSS/images |
| 3 | Browser stores these files in local cache |
| 4 | User revisits the page |
| 5 | Browser serves cached files (if valid) instead of re-downloading |
Potential problem: stale content may be shown until cache expiry/refresh.