3 ms·
> If your query can survive against the read-replica (so stale data is at least sometimes acceptable) would you be better off caching results in redis? Caching
by gwbas1c 3y ago
> If your query can survive against the read-replica (so stale data is at least sometimes acceptable) would you be better off caching results in redis?
Caching adds a lot of complexity. It denormalizes the data, and now you "need to know" when to update the cache. Because "the single source of truth" is no longer maintained, it's easy to accidentally add regressions.
If it's a matter of adding a read replica, that's a much better solution, long-term, because you don't have the effort of "does this query also need to update the cache?"
(I'd think by now there would be a way to expose events in a DB when certain tables are updated; and then (semi) automatically invalidate the cache.)