Two Hard Things: caching bugs · Part 11
Refresh. Different answer.
Three servers, three in-memory caches. A rename clears one copy, the other two keep the old name, and the load balancer flips it on every refresh. Fix: move the cache to Redis, or keep the local cache and broadcast invalidations with pub/sub. Keep a short TTL anyway: pub/sub messages can get lost.
Comment below: How many copies of your data exist right now?
Two Hard Things: a series on the caching bugs you already ship, and how to fix them. "There are only two hard things in computer science: cache invalidation and naming things." (Phil Karlton) All code is real TypeScript on Node, typechecked before it went on screen, and every claim was reproduced against real Redis and Postgres.




