Search code examples
asp.net-mvccachingvarybyparam

Why does OutputCache attribute require the VaryByParam parameter to be set?


I've done zero research on this, I'm just curious.

The OutputCacheAttribute class in ASP.NET MVC requires a value for Duration and VaryByParam. I get why Duration is required, but not VaryByParam.


Solution

  • Update: Ok, as of the latest release of MVC (3), it is no longer required and by default no params are used, i.e. only once cache exists. This is the behavior I had previously expected.