I have a action like this:
[OutputCache(Duration = 3600, Location = OutputCacheLocation.ServerAndClient, VaryByParam = "page;categor;searchString")]
public virtual async Task<ActionResult> Index(int? category, int page = 1, string searchString = null)
This action can have multiple cache result. its fine so far. but when i post a new content, i like to remove all those multiple cache result.
I know i can use RemoveOutputCacheItem
with a list of urls in a foreach or so..
var urls = new List<string>();
foreach (var url in urls)
{
HttpResponse.RemoveOutputCacheItem(url);
}
But for that i have to make several connection to my database and get categories, pages and even if somehow i get all the search string, it's still cause too much trouble.
My question is, Is there a better way to remove all those cache at once?