A caching strategy, explained without the jargon
The version of this that works is simpler than the version most people imagine. Here is a caching strategy without the vocabulary that usually surrounds it.
Performance work is mostly subtraction, which makes it unpopular and effective. Write the reasoning down alongside the decision, because the reasoning is what changes first.
The short version
The fastest request is the one never made. There is a version of this that is over-engineered, and it is worth avoiding. Doing this properly once is usually cheaper than doing it approximately three times.
Why people complicate it
Most of the confusion comes from tooling rather than from the idea itself. This is the sort of thing that compounds, quietly, in both directions.
Cache static assets aggressively with fingerprinted filenames. Where this goes wrong is almost never a lack of knowledge. Doing this properly once is usually cheaper than doing it approximately three times.
Turning this into a decision
Decide your invalidation rules before you need them. Where this goes wrong is almost never a lack of knowledge. Check it against what you would want a competitor's site to get wrong.
What this looks like day to day
Speed is a feature people notice only in its absence, and then they leave rather than complain. Three things worth confirming about a caching strategy before you move on:
- Someone can say what the current setup is without going to look
- Decide your invalidation rules before you need them — and you know whether that is true here
- There is a way to tell whether the last change to this helped
Pick the one that would hurt most if it failed, and start there.