I've been facing some challenges with cache consistency during rolling deployments where multiple versions of services run at the same time, which leads to problems when both versions read from and write to the same cache. I've found a solution that involves versioning cache keys—new deployments will write to new keys while older instances continue to use the previous ones. This approach avoids issues with cache poisoning without the need for Redis flushes or aggressive TTLs. I'm curious how others manage cache consistency during such deployments. Do you rely on time-to-live (TTL) settings, blue/green deployments, dual writes, or something else?
4 Answers
I don’t really think your approach is optimal. It sounds like you’re just creating a different way to invalidate the cache instead of solving the issue. If you’re going to invalidate the cache, why bother with long TTLs in the first place? Shouldn’t there be better practices in place for managing serialized object changes?
I think the issue often arises from breaking changes in shared contracts, not necessarily because of concurrent services. When developers make breaking changes, it really complicates things. We definitely need to encourage backward compatibility as a best practice. Can’t just jump to conclusions without reviewing the situation, though!
Absolutely! It’s crucial to handle backward compatibility with care. Sometimes, those breaking changes happen due to evolving requirements from third-party integrations, and that's where good cache management techniques can come into play.
Honestly, I’ve struggled with cache consistency too. I think versioning your cache is a fantastic idea! It sounds like it really helps limit the headaches during deployments.
For sure! I’d love to try implementing it, especially after seeing some discussions in other communities about similar approaches. It really seems like a smart strat.
I’ve found success with a blue/green deployment strategy where we deploy components separately—like the cache and APIs—to minimize risks. This created a solid isolation between the old and new versions, which worked well for us during transitions.

I get your point. The idea isn’t to invalidate the cache with every deploy; it’s only when there’s a significant breaking change. The long TTLs are necessary for performance, especially in read-heavy apps. This is just a way to isolate changes without continually hitting the cache with invalid data.