CASE STUDY / PERSONAL PROJECT
Cache Lab.
Making the invisible decisions behind an HTTP cache easier to see.
A reverse proxy and interactive lab for exploring what happens between a request, a cache, and an origin server.
- ROLE
- Design & development
- FOCUS
- HTTP caching & observability
- STACK
- TypeScript · Node.js · Vue · Redis

01 / THE PROBLEM
Fast responses need understandable rules.
Caching can reduce repeated work, but it also raises difficult questions: which responses are safe to share, when does data expire, and what happens when an update arrives during a cache fill?
I built Cache Lab to make those tradeoffs tangible. Instead of a black-box hit rate, the project shows requests, exposes a small set of controls, and lets visitors explore eviction policies and failure scenarios with repeatable workloads.
02 / THE SYSTEM
A proxy with a control plane.
The Node.js proxy sits between a client and a configured origin. A Vue dashboard calls a separate control API to change the maximum lifetime, invalidate an exact path, and inspect recent activity.
The storage boundary supports an in-process cache or Redis. In Redis mode, instances share entries, rules, invalidation generations, and aggregate counters. Recent activity and request coalescing remain local to each process.
03 / DESIGN DECISIONS
Correctness before a cache hit.
Conservative by default
The proxy caches eligible GET responses explicitly marked public with a positive shared or ordinary max-age, capped by the configured lifetime. It bypasses requests with credentials, cookies, ranges, or conditional headers, and responses with restrictions such as private, no-store, Vary, or Set-Cookie.
Invalidation that accounts for races
Each exact path and query string has a generation. Purging advances it, so a response from an earlier in-flight fill cannot become the entry read by later requests. Old entries expire naturally.
Reduce duplicate work
Within one proxy process, simultaneous requests for the same cache key wait for an in-flight fill. A response is reused only if it qualifies for caching; this is not distributed request coalescing.
04 / EXPERIMENTS
Make the tradeoffs visible.
Repeatable workloads compare a no-cache baseline with bounded LRU and LFU caches. A hot item competing with a larger scan exposes how recency and frequency can make different eviction choices; changing capacity shows when a working set fits.
Other scenarios explore a burst of concurrent requests for a cold item, expiration and refetching, requests for nonexistent items, and repeated client requests to a failing origin. In the burst, cache bypass is compared with this proxy’s process-local request coalescing. The failure scenario simulates client retries; the proxy does not perform them itself.
Each experiment uses a fresh cache and a controlled origin. The dashboard reports hits, origin requests, evictions, mean latency, and p95 latency. A slowed replay uses recorded request outcomes and durations to show how the paths differ. Policies run separately, and playback is scaled for visibility. These measurements include local overhead and are not production or CDN benchmarks. The LRU and LFU stores are used only for experiments.
Try the experiments ↗05 / DELIVERY & VALIDATION
Built to run locally, shared as a sandbox.
The self-hosted version can run with Docker and Redis. For the public demo, a Cloudflare Worker serves the dashboard and forwards an allowlisted set of requests to a container with a fixed internal origin. Redis runs inside the container, and its state is checkpointed to private R2 storage after changes. When the container wakes, it restores settings, counters, and any unexpired cache entries. Recent request activity remains temporary.
Automated tests cover public caching and bypasses, concurrent misses, invalidation during an in-flight fill, local rule persistence, shared Redis behavior across proxy instances, expiration, and bounded experiment scenarios. The public gateway has separate checks for route restrictions and request sizes.
This is a learning prototype, not a complete HTTP cache. It does not yet implement the full caching specification, distributed coalescing, or bounded streaming of origin response bodies. The public sandbox is not intended for sensitive or production traffic.
EXPLORE THE PROJECT
See the cache in action.
Send a request, compare cache policies, or explore a failure scenario.