You can try this code where you need to define the time interval for caching.
- [OutputCache(Location= System.Web.UI.OutputCacheLocation.Server, Duration=3600,VaryByParam="param1;param2")]
you need to expire the Output cache programatically, and it’s not entirely obvious how to do this, so I have documented it, here:
-
- var staleItem = Url.Action("Action", "YourController", new
- {
- Id = model.Id,
- area = "areaname";
- });
-
- Response.RemoveOutputCacheItem(staleItem);