.NET Architecture & System Design Interview Question #26

What is caching and why is it used in system design?

Caching, CDN, Queues & Asynchronous Processing Junior Beginner

Quick Interview Answer

Caching stores frequently used or expensive-to-compute data in a faster location so later requests can be served with less latency and less load on the original data source.

Detailed Explanation

Caching stores frequently used or expensive-to-compute data in a faster location so later requests can be served with less latency and less load on the original data source.

A cache is an optimization, not the source of truth in most designs. Architects must decide what to cache, where to cache it, how long entries remain valid, and how stale or missing data will be handled.

Code Example

Client -> Application -> Cache
                      |
                  cache miss
                      v
                   Database