Skip to main content

Demo 56

Redis/cache memory growth

Unbounded in-process caches retain data even when Redis or the database is the real source of truth.

fully simulatedcurated scenariodoes not execute real code
Short answer

The Map is a long-lived reference, so every cached value stays reachable.

Real-world bug this helps solve

A production symptom appears first: flaky tests, stale state, slow UI, late cleanup, or growing memory. This shows up in API gateways, profile caches, feature flag caches, permission lookups, and hot service processes.

Common wrong assumption

Assuming Redis TTL protects a separate in-process cache.

Fix direction

Fix the root scheduling, cleanup, or concurrency pattern instead of adding arbitrary waits.

Fixed code pattern
try {
  await operation();
} finally {
  cleanup();
}
Visual proof

The visual proof is the active runtime event: watch what is retained, blocked, queued, or released at each step.

How to verify in a real app

Reproduce the symptom with a small test, apply the safer pattern, then verify the flaky, slow, or leaking behavior disappears.

Share
Loading visual timeline...

Related cases

Continue with nearby confusion while the mental model is fresh.

Recommended next

Was this clear?

This stays local for now. It helps you track where the product still needs sharper cases.

Send detail