Skip to content
Definition
Caching is a technique used to store frequently accessed data or instructions in a special memory (cache) for quick retrieval. The goal is to reduce access time from slower storage mediums, thereby improving overall system performance.

Benefits of Caching

Key Point
Caching benefitWhy it helps
SpeedCache access is far faster than secondary storage access
EfficiencyReuses frequent data instead of repeatedly fetching from slow storage
Reduced loadLowers pressure on databases/disks and network resources

Drawbacks of Caching

Key Point
Caching drawbackWhy it is a problem
Cache size limitsSmall caches cannot hold all useful data; very large caches add lookup overhead
Implementation complexityCache policies/prefetching are hard to tune correctly
Data consistency riskCached data can become stale if source data changes
Cache missesMisses force slow fallback to main/secondary storage
Worked Example
Worked Example: Web Browser Caching
StepWhat happens
1User visits www.example.com
2Browser downloads HTML/CSS/images
3Browser stores these files in local cache
4User revisits the page
5Browser serves cached files (if valid) instead of re-downloading
Benefit: faster page load and reduced bandwidth/server demand.

Potential problem: stale content may be shown until cache expiry/refresh.