So I understand caching data is meant to save from making repeat I/O calls when the (cached) data is not stale.
My question is this: lets say I retrieve my query results and then store the data in cache, another user then updates a record in the underlying data, am I able to “reset” the cache with the new data upon the completion of the update command – and in a sense ignore cache expiration policies altogether? Im using CQS so all mutations to my dataset are done via command and event handlers – note that I do not have separate read write stores, just separate models for commands and queries, but they act on the same DB instance (mssql). Would it be as simple as repopulating the cache when handling the event? Do I have to worry about expiration policie?
If you happen to have any good resources, best practices, or sample code that would be much appreciated. I have a pluralsight sub but there are very few courses on caching in C#..