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")]
If you want to clear output cache programatically then you can use following code:
-
- var staleItem = Url.Action("Action", "YourController", new
- {
- Id = model.Id,
- area = "areaname";
- });
-
-
- Response.RemoveOutputCacheItem(staleItem);