0

I'm working with MVC 5 and Razor engine.
I have a controller's action as the following:

[HttpPost]
[ValidateAntiForgeryToken]
[OutputCache(Duration = 120, Location = OutputCacheLocation.Server, VaryByParam = "*")]
public PartialViewResult Index(DevicesAjaxViewModel viewModel)
{ ... }

As you can see the action parameter is a class, when ever I'm using OutputCache nothing cached and action runs in each request. I thing it's because of cache key.
So how can I customize OutputCache? Is it possible?

Mohammad Dayyan
  • 21,578
  • 41
  • 164
  • 232
  • Did you checked http://stackoverflow.com/questions/15193383/outputcache-varying-by-a-complex-object-property – PSK Apr 12 '15 at 05:23

1 Answers1

1

You do not have caching because VaryByParam is set to everything - *. Usually that option is used to specify part of the input parameters (your viewModel) of the controller action.

Lyubomir Velchev
  • 962
  • 2
  • 11
  • 30