Is there any way I can vary caching by a controller action parameter using the outputcache attribute? We have varybyparam which will not work if my parameters are embedded within the URL in a REST manner.
相关问题
- MVC-Routing,Why i can not ignore defaults,The matc
- parameters in routing do not work MVC 3
- There is no ViewData item with the key 'taskTy
- TextBoxFor decimal
- jsp caching tag library
相关文章
- How to get a list of connected clients on SignalR
- How do you redirect to the calling page in ASP.NET
- Change color of bars depending on value in Highcha
- The program '[4432] iisexpress.exe' has ex
- ASP.Net MVC 4 Bundles
- Is there a google API to read cached content? [clo
- How to get server path of physical path ?
- Cannot implicitly convert Web.Http.Results.JsonRes
Its also important to realize in a Action method that 'VaryByParam' does not mean 'Vary by the parameters being passed into that action method'. it means 'vary by the parameters being passed into that action method that originate as HTTP parameters'.
Lets say the route for this action method is :
As Craig says above, the key parameter is part of the URL and therefore caching doesn't apply to it - so it is essentially always cached.
The mode parameter which would be sent via a '
?mode=1
' type would apply to the caching.Caching works this way by default. Different URLs give different cache locations. Perhaps there is something missing from your question, but, as stated, it already works this way.