roadmaps / cache-aside-redis
9 steps · ~45 min · intermediate · free · ships with the app
Cache-aside with Redis
Nimbus Books survived launch day — now success is the problem: every page load hammers PostgreSQL with the same expensive catalog query. Feel a slow store on real containers, then fix it the way the industry does: a Redis cache-aside layer. Watch a 1500 ms page drop to a few milliseconds, kill your cache on purpose to prove the store survives it, and meet the one problem every cache carries: stale data.
before you start
- Docker installed and running
- A Torollo project created and open on the canvas (start from an empty one)
- Comfortable running basic commands in a Linux terminal
- Having played "Deploy a resilient three-tier app" helps, but this story stands on its own
The 9 steps and what each one checks
Every step ends with a validation pass that inspects your actual containers. The lines below are the exact observations it makes. The instructions, hints and commented walkthroughs live in the app.
step 1 of 9
Reopen the store
- check: container "web" is running
step 2 of 9
The catalog
- check: container "db" is running
- check: table "books" exists in "db"
step 3 of 9
Least privilege, day one
- check: web → db is reachable on :5432
step 4 of 9
The 1500-millisecond problem
- check: GET :80/ on "web" contains "Nimbus Books"
- check: GET :80/ on "web" contains "The Pragmatic Programmer"
step 5 of 9
Enter Redis
- check: container "cache" is running
- check: web → cache is reachable on :6379
- check: cache → db is blocked on :5432
step 6 of 9
Cache-aside
- check: GET :80/ on "web" contains "Nimbus Books"
- check: key "cache:books" exists in "cache"
step 7 of 9
Prove the hit
- check: key "stats:hits" exists in "cache"
- check: GET :80/ on "web" contains "served from cache"
step 8 of 9
The cache goes dark
- check: key "stats:drills" exists in "cache"
- check: container "cache" is running
step 9 of 9
The stale catalog
- check: GET :80/ on "web" contains "Phoenix"
- check: GET :80/ on "web" contains "served from cache"
Play it on your machine
This roadmap ships free with the app. The only requirement is a running Docker daemon.
$ npx torollo start
MIT licensed · source on GitHub