Let us say you have an asp.net MVC controller/action which is donutcached like below. And you want to bust the cache for some reason. An example would be. You cache a partial view for 24 hours, but give the user a refresh button to allow him to manually refresh it if he wishes to.
NOTE: you cannot use web.config based cacheprofiles for MVC. It just doesn’t work, so DonutCache is being used for that.
[DonutOutputCache(CacheProfile = "CachedAction")]
public ActionResult CachedAction(string id)
Here is the web.config
<outputCache enableOutputCache="true" />
<add name="CachedAction" duration="14100" varyByParam="*" location="Any" />
public void BustCache(string id)
var Ocm = new OutputCacheManager();
RouteValueDictionary rv = new RouteValueDictionary();
Ocm.RemoveItems("controller", "cachedaction", rv);
Finally you would simply make two ajax calls. First, you bust your cache and then you call your regular MVC action to get your content.