Itâ€™s easy to set up a cache in front of oneâ€™s SQL DB to improve performances. If the app is the only component that writes to the underlying DB, the cache is always up-to-date. Things start to go sour when the app is not the only component that writes. There are ways to keep data in sync but they all have issues that make them unreliable and/or fragile.
You might have read about Change-Data-Capture: the DB can send change events that one can register to. Once CDC is in place, one can update the cache accordingly. In this talk, Iâ€™ll set up an evergreen cache by leveraging CDC.