🔹 What is a Cache?
A cache is a temporary storage that holds frequently accessed data so it can be retrieved faster the next time it’s needed.
Example: When you open a website, your browser may cache the images or styles so the next visit is faster.
🔹 What is a Cache Miss?
A cache miss occurs when the requested data is not found in the cache.
Instead of serving it quickly from memory, the system must:
-
Go to the slower backend storage (e.g., database, disk, or server)
-
Fetch the data
-
Optionally store it in cache for next time (called cache population)
🔹 Types of Cache Misses:
| Type | Description |
|---|---|
| Compulsory Miss | First-time access — cache has never seen the data |
| Capacity Miss | Cache is too small to hold all data; older data gets evicted |
| Conflict Miss | Multiple data items map to the same cache location (in direct-mapped caches) |
🔹 Analogy:
Think of your refrigerator (cache).
You go to get milk (data), but it’s not there → cache miss.
So you go to the store (main memory/database), get milk, and put it in the fridge.
🔹 What Happens During a Cache Miss?
-
Check cache → Miss
-
Fetch data from main storage (DB, file system, API, etc.)
-
Optionally cache the data for future requests
-
Return data to requester (user, app, etc.)
🔹 Why Cache Misses Matter:
-
Increases latency
-
Increases load on the backend
-
Affects system performance and scalability
That’s why cache hit ratio (hits / total requests) is a key metric.