liveBook · Manning

Caching

As explained in Fast by Default

A cache is a storage layer containing reusable copies of data or computation results to avoid repeated retrieval or calculation.

Caching adds a storage layer for reusable data or computation results, reducing repeated retrieval and calculation. It improves performance only when its capacity, freshness, invalidation, and failure behavior remain controlled as usage grows. section 1.4 section 4.5.3

Design a cache around explicit operational safeguards:

  • Cache only needed data rather than entire datasets, and keep memory usage bounded with size limits. section 4.5.3
  • Set expiration policies so stale entries refresh even when explicit invalidation fails. section 4.5.3
  • Invalidate derived data when its source changes, and define acceptable inconsistency windows before distributing the cache. section 4.5.3
  • Check whether cache failure degrades gracefully or overloads the database, especially when preparing for tenfold growth. section 4.5.6

Dashboard filters and mobile thumbnails

A slow dashboard fetched data sequentially, recomputed results between interactions, and re-rendered heavily. Caching repeated computation became one part of a broader fix. In a mobile app, moving image decoding off the main thread and caching pre-resized thumbnails eliminated scrolling hitches. section 1.4 section 7.3.2

Figure 1.5 The slow dashboard’s System Paths. Each stage has problems that add to the total delay: the User stage triggers unnecessary re-renders, the Data stage makes sequential requests without caching, the Execution stage re-renders excessively with heavy libraries, and the Result stage shows incomplete states before data arrives.

Trace caching through the dashboard’s Data path alongside sequential requests, execution work, and incomplete result states. section 1.4

How Fast by Default covers it

How deep it goes
Explains bounded storage, expiration, invalidation, distribution, consistency trade-offs, and graceful failure, but not cache implementation code.
Examples
Uses dashboard filter computations, Redis Cluster and Memcached, and pre-resized mobile thumbnails to illustrate caching choices.
What it assumes
Assumes familiarity with application data flows and performance symptoms while teaching cache growth, staleness, invalidation, and consistency risks.
What you can do after
Operate/configure caches with size limits, expiration, invalidation, consistency boundaries, and failure-degradation checks.
How it connects
Connects caching to performance engineering, distributed caching, cache invalidation, eventual consistency, memory limits, and rendering performance.

Also explained in

Compare how 49 books explain caching →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Fast by Default. The section links point to the parts of the book it draws on.