Search code examples
c#azureazure-caching

Azure caching group strategy


I have a page with one main query with a bunch of filters on it, maybe 9 different dimensions.

I currently check my azure cache for the query parameters. If it's there, I take that. If not, I query sql and update the cache. All of that is working nicely.

My problem is that if I update the data in the database I'd like to invalidate all the cached items associated with my query.

My hope is that there's a "group" key or something like it. That way, I could invalidate an entire group of cached key/value pairs.

Is there a way to invalidate a group of caches in azure? Or is my best bet to invalidate the entire cache? (which I don't know how to do either)


Solution

  • Cache invalidation is typically done through notifications. The Shared Cache service (where you set it up through the portal and select a size from 128MB-4GB) does not support notifications.

    The In-role cache that was introduced in June 2012 supports notifications and is part of the 1.7 SDK. Which cache type are you using?

    Here's a reference page for getting started with in-role caching. And here's a reference for notifications.