Page caching

suggest change

You can use the ActionPack page_caching gem to cache individual pages. This stores the result of one dynamic request as a static HTML file, which is served in place of the dynamic request on subsequent requests. The README contains full setup instructions. Once set up, use the caches_page class method in a controller to cache the result of an action:

class UsersController < ActionController::Base
  caches_page :index
end

Use expire_page to force expiration of the cache by deleting the stored HTML file:

class UsersController < ActionController::Base
  caches_page :index

  def index
    @users = User.all
  end

  def create
    expire_page :action => :index
  end
end

The syntax of expire_page mimics that of url_for and friends.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Caching:
*Page caching

Table Of Contents
19Caching
55CSV