It is also important to implement in the Action method that "VaryByParam" does not mean "Changed by the parameters passed to this action method." this means that "depends on the parameters passed to this action method that come from the HTTP parameters."
[OutputCache(CacheProfile = "ContentPage", VaryByParam = "mode")] public ActionResult Index(string key, string mode) { }
Assume the route for this action method:
routes.MapRoute( "video-route-short", "video/{key}", new { controller = "Video", action = "Index", key = (string)null } );
As Craig says above, the key parameter is part of the URL, and therefore the cache does not apply to it - therefore, it is essentially always cached.
The mode parameter that will be sent using the type ' ?mode=1 Mode ?mode=1 , applies to caching.
source share