Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does the OutputCacheFilter in the Microsoft MVC Preview 4 actually save on action invocations?

We deployed a live, fresh, swanky site using preview 3 including rigorous stress testing.

Page Output caching was our saviour and afforded us the ability to meet our performance contractual requirements.

My question is, is there a difference between action OutputCacheFilter and page output caching?

Is the action output caching faster than page output caching?

like image 941
CVertex Avatar asked Aug 14 '08 04:08

CVertex


2 Answers

Internally, the OutputCacheAttribute (aka output cache filter) uses the same internal mechanism as page output caching (aka the @OutputCache directive).

Therefore, it's not any faster than page output caching. However, with MVC, you really can't use page output caching via the @OutputCache directive in MVC because we render the view (aka page) after the action runs. So you would gain very little benefit.

With the output cache filter, it does the correct thing and does not execute the action code if the result is in the output cache. Hope that helps. :)

like image 142
Haacked Avatar answered Oct 30 '22 02:10

Haacked


Just be aware that there currently is a bug if you call Html.RenderAction(..) on an Action that is marked to be cached. Instead of the specific action being cached, the entire page gets cached. I reported this on codeplex already and it seems to be a known issue: Calling <% HTML.RenderAction<...>(...); %> to an Action with [OutputCache(..)] causes entire page to cache.

like image 22
Ricky Avatar answered Oct 30 '22 01:10

Ricky