Skip to content
Log in

Caching Design

Decides invalidation before anything else, since a cache without an invalidation story is a bug with latency benefits.

0

Share this prompt

Free — no card needed

Create a free account

to open Caching Design — and the other 364 prompts across 21 categories.

We store your email address to send these. We never sell it or pass it to advertisers. Withdraw at any time. Privacy Policy.

Already have an account?

CategoryCodingForDevelopersTested onClaudeChatGPT

Running it, start to finish

  1. State how stale the value may be before it matters.
  2. List every writer and confirm each invalidates.
  3. Verify the key includes every input the value depends on.

What you get back

The output this produces, every time.

  • Starts from staleness tolerance, which determines the whole design.
  • Requires you to list every writer, since the one that does not invalidate is the bug.
  • Checks the cache key covers every dimension the value depends on, including permissions.

Getting better results

Where this usually goes wrong, and how to avoid it.

  • Consider not caching. A better query or an index avoids a second source of truth and a class of bug that is hard to reproduce.
  • Plan for the stampede. A popular key expiring under load takes down the system it was protecting, at the worst possible moment.
  • Check the key for permissions. Anything permission-dependent cached under a shared key serves one user another's data, and it is not caught by tests.

More Coding prompts

All Coding

Written for The AI University. Every prompt in this library is original work — authored, tested and revised here, not collected from elsewhere. 365 of them, free with an account.