I have a .net core web app with multiple instances and want to have a caching strategy that allows me to clear 'sections' or 'regions' of the cache, and ensure the changes are applied across all instances.
The current implementation works great with in memory caching (fast, no dependencies), but will not work with multiple instances of each web app.
For any services required, I'd like to stick with Azure for ease of billing for the client.
So far I've looked into:
Using the existing in memory cache + service bus to subscribe to cache events to ensure all services are synced
- Clearing regions with cancellation tokens in .net core: https://stackoverflow.com/a/45543023/3045412
- Subscribing to service bus from .net core web app https://damienbod.com/2019/04/23/using-azure-service-bus-queues-with-asp-net-core-services/
Using Redis as a distributed cache
- Will need to work out how to clear by region, perhaps something like this? Redis Stack Exchange how to delete or get keys by pattern
Interested to hear if others have a better solution to this, or any feedback/experience with the above options.