Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mvc-mini-profiler with OutputCacheAttribute

im using mvc-mini-profiler on a test site. When i put an OutputCacheAttribute on my action method, the profiler is not executed and always return the last value that he had before the cache.

is there a way to tell mvc-mini-profiler that the result come from the cache so it can update his state? Maybe on the client site, we could see this kind of information:

http://localhost/Home (from cache) 2.1ms,  +0.5ms 
like image 345
Alexandre Jobin Avatar asked Jul 25 '11 23:07

Alexandre Jobin


1 Answers

Applying output caching to a controller action also caches the profiler results. When OutputCache is applied to a controller most of the ASP.NET MVC pipeline is not executed.

You could add the date-time information of when the page was generated to the profiler, something like:

profiler.Step("Generated: " + DateTime.Now.ToString());
like image 127
jorgebg Avatar answered Nov 16 '22 02:11

jorgebg