caching

  • A Redis container without persistence is a deliberate choice

    The official Redis image saves to disk by default, and a cache that survives a restart is occasionally what you want and usually a way to carry a…

  • Cache keys need a version, or you cannot ship a change

    Changing the shape of a cached value means every cached entry is now wrong, and there is no way to clear them selectively without knowing every key that…

  • A circuit breaker before the third-party outage

    A payment provider was slow and the whole site went down with it. A timeout bounds one request; it does nothing about how many are waiting at once.

  • Object cache misses are invisible without instrumentation

    A persistent object cache either works or silently does not, and both look identical from the front end: the site is up, the pages render, and the queries…

  • Designing an API two mobile clients can live with

    Two apps, two release cycles, and neither can be forced to update. What is additive, what is not, and the decisions that have to be made before the…

  • A cache stampede on a single hot key

    A cached value expiring under load means every request that arrives in the next few hundred milliseconds recomputes it simultaneously — so the moment of highest cost is…

  • A CDN in front of an API needs a Vary header

    A cache keys on the URL. If the response depends on anything else — an Accept header, a language, an authorisation token — the cache will serve one…

  • The DEL that blocked the server, and UNLINK

    A 400ms pause on every request, once an hour, caused by a cache cleanup nobody thought of as expensive. Redis is single-threaded, and freeing memory is work.

  • Read replicas, and the queries that must not use them

    Reads moved to a replica and checkout started showing empty carts. Read-after-write, sticky connections, and measuring the lag rather than assuming it.

  • Probabilistic early expiry beats a lock

    Rather than coordinating who recomputes, let each reader decide independently with a probability that rises as the expiry approaches — so one request refreshes early and the rest…