Name the version explicitly
Versioned caching assigns distinct keys to different revisions of the same logical resource. A key such as product:42:v7 identifies both a product and a particular data revision. This differs from merely attaching a deployment number: software schema changes and product-price changes have different lifecycles. Decide which changes advance each component before implementing invalidation. Readers must be able to discover the intended generation without assuming that the most recently cached value is necessarily authoritative.
Trace publication order
Suppose generation 7 contains a price of 1,000 and generation 8 should contain 1,200. Publish the immutable generation-8 value before changing the current-generation pointer. Reversing that order creates a window in which readers request a missing value. Even with the safer order, eviction can cause a miss, so the loading path still needs the authoritative store. Immutability prevents one cached payload from becoming a mixture of fields copied from different revisions.
Prevent an older writer from winning
Two refreshers can complete out of order. If generation 9 has already been published, a slow generation-8 refresher must not reset the current pointer to 8. Use an authoritative monotonic revision and a conditional update, or make the pointer part of the same transactional publication boundary. A random UUID identifies a revision but does not order revisions. Wall-clock timestamps also need an ordering policy when clocks disagree or two changes share a timestamp.
Bound retention and state the guarantee
Old keys continue occupying space after a pointer switch. Apply TTLs or generation-aware reclamation, and decide whether old readers may finish using their original revision. Retaining every historical value indefinitely is not required by the pattern. A list containing many independently versioned products is also not automatically a consistent database snapshot. Versioning helps identify cached representations; it does not replace authorization, transactional updates, or a recovery plan for the authoritative data store.
For composite representations, record which input revisions were used to build the cached output. A page-generation identifier can differ from the revision of each product it embeds. Observability should distinguish the revision found in the cache from the revision the caller requested. This makes stale publication and incorrect dependency selection easier to investigate without treating every cache hit as a correct response.