In an ordinary application, the same information may be retrieved from the database in several ways. If all those ways implement caching, you need to invalidate all those cache entries when updating an entry in the database.
Some pairing between updates and selects is easy to do. Let's take an example of a product 123 in the category 9 with a price of $12.50. If you select a product by ID:
select [...] from [Shop].[Product] where [ProductId] = 123
caching it with a key
Product<Id:123>, it's not so difficult to invalidate this cache entry after updating a price of a product identified by its ID:
update [Shop].[Product] set [Price] = 14.99 where [ProductId] = 123
Things become more difficult when you have also to remember to invalidate the cache with the key
MostExpensive<CategoryId:9> corresponding to the query:
select max([Price]) from [Shop].[Product] where [CategoryId] = 9
What is an effective way to keep track of cache entries? How to find, during development or code review, what entries must be invalidated when one or another piece of data is changed?