A hit does not establish freshness
Stale-cache inconsistency occurs when the authoritative source changes but a reader continues receiving an earlier value. Returning a value within its configured TTL can follow the cache’s rules while violating a business requirement. A profile display and an authorization revocation may tolerate very different delays. Define the authority and who must observe an update after success before selecting a mechanism. High hit rate and freshness are separate properties. Also distinguish the layer that actually answered: an in-process map, shared cache, CDN, browser or cached query result can each retain different history. A successful update in one layer does not establish visibility through all the others.
Trace a stale refill after invalidation
Consider a hypothetical schedule. Reader R begins fetching source version 7 and pauses. Writer W commits version 8 and invalidates the cache. R then finishes and stores version 7, reintroducing stale state after a successful invalidation. This is an ordering example rather than a reported outage. Moving deletion before the write can leave a different race, so inspect the complete sequence instead of choosing order by intuition. Correlate notification, retrieval and cache publication by object identifier. The key question is which historical value was published after which update. A rule saying always delete on update does not by itself prevent every stale refill.
Identify the layer and version actually served
Record the key, source revision, cached revision, generation time, TTL or Age information and actual destination. Timestamps from different hosts do not automatically share an accurate clock; a suitable monotonic data revision can provide stronger ordering evidence. For user-dependent values, check whether keys include the necessary authorization context. Returning another user’s representation is not repaired simply by shortening expiry. A refill that reads a lagging replica can also return an older value even when the code believes it has queried the source. Establish what each path can observe and avoid promoting the name source into a guarantee that every connection has the latest committed version.
Choose recovery according to business freshness
Options include bounded TTLs, change-driven invalidation, versioned keys, rejection of older writes and routing selected requests to an appropriate authority. Specify each mechanism’s enforcement boundary and failure behavior. TTL commonly limits time since insertion, but does not necessarily include how stale the fetched value already was before insertion. For operations such as recently revoked access, narrow the conditions under which cached state may authorize an effect. A client that missed notifications may need to discard local values on reconnect. Retry and ordering rules also matter for invalidation so that a delayed older request cannot regress a newer generation. Match the chosen policy to the business guarantee rather than treating every object as equally tolerant of staleness.
Validate both latency and staleness
Retest concurrent updates and reads, slow refills, lost notifications, replica delays, reconnects and distinct users. Observe returned versions and the fraction exceeding the freshness budget alongside average latency. Clearing every cache simultaneously can overload the source, so inspect refill concentration and duplicate fetches too. A test that merely sleeps a fixed duration after updating can miss delays longer than that assumption. Confirm the intended visibility using operation identity or revision evidence. The completion criterion should include both useful response time and the correct permitted representation. This separates a faster stale response from an actual repair of the user-visible consistency problem.