Read-through caching makes the cache an active participant in reads. On a miss, it retrieves the key from the backing store, updates itself, and returns the value to the application. The application therefore sees the same lookup interface whether the value was cached or had to be fetched. section 6.3.2
The strategy shifts responsibility from application code into the cache:
- Reduces application-side cache management because the cache coordinates misses, backing-store reads, and cache updates. section 6.3.2
- Requires the cache to understand the data model and transform backing-store results, such as SQL rows, into JSON or another cache format. section 6.3.2
- Can provide transactional guarantees and consistent handling of concurrent cache misses when it coordinates database reads and cache updates. section 6.3.2
- Still exposes backing-store latency on misses, although the cache-to-store path may be shorter and active behavior can hide tail latency. section 6.3.2
- Can use refresh-ahead caching to update entries asynchronously before expiration, reducing the effect of expired values. section 6.3.2
Database-backed key lookup
An application requests a key from the cache. If the key is absent, the cache queries the database, converts the result into a cacheable representation, stores it, and returns it. A later request can be served directly from the cache. section 6.3.2
Figure 6.2 With read-through caching, the client looks up a key from the cache. Unlike with cache-aside caching, the read-through cache queries the database and updates itself on a cache miss.
Trace the request path from application lookup through cache miss, database retrieval, cache update, and response. section 6.3.2
