intermediateCaching

Cache a Hot Read

Decide what you would build from the brief alone. Everything below it is available, but the exercise stops working if you open it first.

The brief you were given

GET /users/:id/profile is the most-called endpoint you have and it queries four tables. Add caching.

The trap — the wrong fix that looks right

Reaching for Redis before checking what the endpoint spends its time on. Four tables suggests joins; if the cost is one unindexed lookup, an index removes the latency and leaves the data consistent, with no new dependency and no invalidation work. A cache in front of a query that was fixable makes the system permanently harder to reason about and hides the original problem — which surfaces again the first time the cache is cold or unavailable.