Last modified: January 24, 2026

This article is written in: 🇺🇸

Caching

Caching is a technique used to speed up data retrieval by placing frequently accessed or computationally heavy information closer to the application or the end user. Below is an expanded set of notes on caching, presented with a simple ASCII diagram and bullet points that emphasize key considerations. Each bullet point is a complete sentence containing a single bold word in the middle.

+-------------+           +-------------+
  |   Client    |           |   Server    |
  |             |           |             |
  |             |  Request  |             |
  |             +---------->+             |
  |             |           |             |
  |             |<----------+             |
  +------+------|           +------+------+
         |Cache |           |  Data  |
         |Miss  |           | Storage|
         |      |           |        |
         |      |           |        |
  +------v------+           +--------v-----+
  |   Cache     |           |              |
  |(Fast Access)|<----------+              |
  +-------------+  Cached   |              |
                            |              |
                            +--------------+

Types of Cache

Modern computing stacks use multiple caches at different layers, each addressing a specific scope and performance requirement.

Cache Write Policies

Different write policies determine how the cache interacts with the underlying data store during write operations.

Cache Eviction Policies

When the cache is full, an eviction policy determines which items to discard so that new items can be stored.

Cache Invalidation and Consistency

Ensuring that the cache reflects changes in the underlying data store can be one of the most difficult aspects of caching.

Multi-Layer Caching

Some architectures employ multiple cache layers, each targeting different bottlenecks or data usage patterns.

|
  | (Browser Cache)
  |
  v
Reverse Proxy / CDN
  |
  | (Edge Cache)
  |
  v
Application Server
  |
  | (In-Memory Cache)
  |
  v
Database or Persistent Store

Monitoring and Metrics

Effective caching strategies rely on continuous monitoring and tuning based on real-world usage patterns.