Skip to content

Caching

Prime #
154
Origin domain
Computer Science & Software Engineering
Also from
Systems Thinking & Cybernetics, Operations Research, Cognitive Science
Aliases
Memoization, Cache, Locality Exploitation
Related primes
Hierarchy, Locality Of Reference, Trade-offs, Indirection, eviction policy

Core Idea

Caching involves storing frequently or recently used resources, computations, or actions in a more immediately accessible or efficient form, reducing the need for repeated retrieval or recomputation.

How would you explain it like I'm…

Keep a Snack Close

Imagine your favorite toys live in the attic. Climbing up every time is slow. So you keep a small box of them next to your bed. Now most days you just grab from the box. That little box is a cache — close stuff you reach for over and over.

Fast Copy Nearby

A cache is a small, fast copy of something that's normally slow or far away. Think of writing notes in a notebook so you don't have to look things up in a giant library every time. It works because of a simple pattern: things you used recently or things near them are likely what you'll want next. The trade-off is space — your notebook is small, so you have to choose which notes to keep and which to toss when it fills up.

Local Copy for Repeated Access

Caching is the trick of keeping a small, fast, local copy of information whose original is slow to fetch. Your browser caches images so a page loads instantly on a second visit. Your brain caches the route to school so you don't re-plan it every morning. The trick works because real-world access patterns aren't random — they cluster in time (you reuse the same thing) and in space (when you grab one thing, you usually want what's nearby). This is called locality of reference. Three design choices govern any cache: how big it is, what rule decides what gets kicked out when it fills, and how you keep the copy in sync with the original when it changes.

 

Caching is the architectural technique of maintaining a fast, local, usually-smaller copy of information whose original is slow or expensive to produce or fetch, so that repeated or nearby accesses are served from the copy rather than from the source. It exploits locality of reference — the empirical observation, formalized by Denning, that real workloads exhibit both temporal locality (recently-accessed items are likely to be re-accessed) and spatial locality (items near recently-accessed items are likely to be accessed soon). The core commitment is that a two-tier (or multi-tier) hierarchy with a small-fast tier and a large-slow tier can dramatically outperform either tier alone for workloads with sufficient reuse. Cache effectiveness depends jointly on workload locality, cache size and organization (direct-mapped, set-associative, fully-associative), replacement policy (LRU, LFU, ARC, clock), and the coherence protocol that maintains correctness when the underlying source can change. Caching recurs at every level of computing — CPU registers, L1/L2/L3, RAM as a cache for disk, DNS resolvers, CDNs — and far beyond it.

Broad Use

  • Computing: CPU caches reduce redundant memory accesses, web caches optimize load times.

  • Biology: The human brain stores frequently accessed information in working memory, avoiding the need to recall from deeper storage.

  • Logistics: Warehouses near high-demand areas act as caches for quick shipping.

  • Economics: Keeping cash reserves (liquidity buffers) reduces transaction overhead in financial operations.

  • Education: Teaching frameworks rely on scaffolding, reusing core concepts so they don't need to be re-taught from scratch.

Clarity

Focuses on reducing redundant effort, whether it's retrieving stored data, recalling knowledge, or redoing a physical process.

Manages Complexity

Introduces a tiered approach to access and computation—some things are immediately available, while others remain in deeper layers for infrequent use.

Abstract Reasoning

Encourages thinking in efficiency layers, where some information, materials, or actions are stored closer to immediate use, while others are deferred.

Knowledge Transfer

The principle applies to any field requiring prioritization of fast access resources (e.g., emergency kits in disaster response, reusable design patterns in architecture).

Example

A musician memorizing key scales and chord progressions so they don't have to think about them consciously every time they improvise.

Relationships to Other Primes

Parents (3) — more general patterns this builds on

  • Caching presupposes Locality Of Reference — Caching presupposes locality of reference because exploiting a fast-local copy only pays off when accesses cluster temporally or spatially.
  • Caching presupposes Optimization — Caching presupposes Optimization: keeping a fast local copy minimizes expected access cost under locality and capacity constraints.
  • Caching presupposes Reserve — Caching presupposes reserve because the fast local copy is a deliberately maintained surplus held against repeated access demand.

Children (1) — more specific cases that build on this

  • Two-Store Architecture presupposes, typical Caching — Shares the fast-store/slow-store substrate pair with caching (0.91 nearest) but REVERSES the origination flow (born-fast-migrates-slow vs born-slow-mirrored-fast); contrast-sibling rather than is-a. Recorded as a weak presupposes-link to the fast/slow-tier machinery; owner may prefer a bare mutual_with caching.

Path to root: CachingOptimization

Not to Be Confused With

  • Caching is not Buffering because caching stores frequently-accessed items near the point of use to reduce latency, while buffering temporarily holds items to smooth demand-supply mismatches. Caching is proximity-based storage for speed; buffering is transient holding for flow management.
  • Caching is not Chunking because caching stores entire retrieved items to avoid refetch, while chunking groups elements into meaningful units to reduce working-memory demand. Caching is about reuse avoidance; chunking is about grouping for comprehension.
  • Caching is not Search and Retrieval because caching stores pre-computed or frequently-used items to avoid the search process, while search and retrieval is the mechanism for finding and accessing stored items. Caching is a performance optimization around search; search is the underlying operation.