Production Caching with Spring, Redis, Memcached, and Hazelcast
Seventeen chapters on caching in production without the handwaving. Covers the four caching patterns, Caffeine for in-process caches, Redis and Memcached as remote backends, Hazelcast for JVM-native distributed caching, invalidation done correctly, thundering herd prevention, multi-tier L1/L2 strategies, and failure modes from real postmortems.
~620 pages
2026
English
Coming Soon
What you'll learn
Cache-aside, write-through, write-behind, and read-through: when each pattern fits
Caffeine for in-process caching with maximumSize, TTL, and eviction policy design
Redis as a caching backend: connection pooling, serialization, and key hygiene
Memcached vs Redis: an honest comparison for different workload types
Hazelcast for JVM-native distributed caching and near-cache patterns
Cache invalidation done correctly: events, tombstones, and version keys
Thundering herd prevention with stampede coalescing and probabilistic early expiry
Multi-tier L1/L2 caching with Caffeine in front of Redis
Transactional caching pitfalls in Spring and how to avoid them
Bloom filters, negative caching, topology planning, and failure mode postmortems
Table of Contents
17 chapters · Standalone examples
- 01 Why Cache?
- 02 The Cache as a Distributed System
- 03 Keys, Values, and Identity
- 04 The Four Patterns
- 05 Caffeine, the In-Process Cache Done Right
- 06 Redis, the Workhorse
- 07 Memcached, Less Is More
- 08 Hazelcast, the JVM-Native Distributed Map
- 09 Choosing a Backend
- 10 Invalidation, Honestly
- 11 Stampedes, Coalescing, and the Thundering Herd
- 12 Multi-Tier Caches (L1/L2)
- 13 Transactional Caching with Spring
- 14 Negative Caching, Bloom Filters, and the Long Tail
- 15 Topology and Capacity
- 16 Observability
- 17 Failure Modes, Postmortems, and Multi-Region