I am creating an application where I am using caching to reduce the latency and load on my DB. The problem I am facing is the caching client I am using provides async call for publishing data to remote distributed cache so I am not able to figure out how to handle such behavior.
For eg. - there is variable X=10
present in both DB and cache.So when X changes its value to X=20
I want to ensure at both DB and cache its value gets updated. For DB I am able to make a sync call so its fine there but with cache I have async method which returns void so I can't enough to ensure the successful cache publish scenario.
The thing is I don't want to read stale data from cache I always want to read updated latest data.
Is there any workaround for such kind of problems ?