"The cache key is a promise: identical key means identical sound. Break the promise and the cache lies."
The Key Is the Whole Game
A content-addressed cache is only as good as its key. The rule is exact: the key must include the normalized text and every input that could change the resulting audio — the resolved binding, the model, the voice settings, the language, the pronunciation dictionary version, the seed, and any surrounding context. Get the list complete and the cache is a guarantee. Get it wrong and the cache becomes a confident liar.
Two Ways to Be Wrong
Leave something out — say the model version — and two genuinely different requests hash to the same key. The second one gets the first one's audio, subtly wrong and served with total confidence. That's an under-specified key, and it's the dangerous failure. The opposite mistake is an over-specified key: fold in something that doesn't affect the audio, like a timestamp, and identical requests never collide — so you pay every single time and the cache never earns its keep.
Normalize First, Then Hash
Notice that the key hashes the normalized text, not the raw text. Two inputs that differ only in ways normalization erases should produce the same audio, so they must produce the same key. That's why normalization (Track 7) runs before identity: the cache is keyed on what will actually be spoken, not on incidental differences in what was typed.