← All notes
Reliability

A stale answer beats no answer

What a cache should do when the thing behind it goes down — and why an expiry is two dates, not one.

A conventional cache entry has one date on it: the moment it stops being valid. After that the entry is gone and the next reader waits for the provider.

That is the wrong behaviour precisely when it matters most. If a provider is down, every cached answer expires and every reader gets an error — the cache evaporates exactly when it would have been most useful.

Two dates instead

Norien gives every entry an expiry and a discard time. Past the expiry the entry is no longer served to a healthy request; the provider is asked again. But it is not deleted. If that request fails, the stale entry is served instead, and the response says so.

A price from ninety seconds ago, labelled as such, is worth far more to someone reading a dashboard than a red error box. The discard time is what stops that from becoming dishonest: past it, the entry really is gone, because at some point old data stops resembling the truth.

The same reasoning shapes the failure mode of the whole aggregation layer. A request that touches four providers and gets three answers returns three answers with degraded set, not a 500. Partial data, visibly partial, beats nothing.