class SampleController < ApplicationController
I learned from the book Programming Microsoft® ASP.NET MVC, Second Edition that we should use System.Web.Mvc.OutputCacheAttribute class on each actions like below:
public class SampleController : Controller
public ActionResult Home()
The advantage of rails way is there are two directives: cache_page and cache_action. cache_page does not execute any actions and filters, but, cache_action only executes filters while ASP.NET MVC has only OutputCache attritbute that does not execute any actions and filters too.
On the other hand, the advantage of ASP.NET MVC way is easy to define expiration seconds of caching while rails' one is more difficult.