Rails Caching

Enable caching in the development

rails dev:cache

Page Caching

Since Rails 4 Page Caching has been extracted to the actionpack-page_caching.

In config/application.rb:

config.action_controller.page_cache_directory = "#{Rails.root.to_s}/public/deploy"

Page caching is enabled per-action by using caches_page method.

class PagesController < ApplicationController
  caches_page :index

Action Caching

Fragment Caching

HTTP Caching

Subscribe to My Newsletter

The latest programming-related news, articles and resources - sent to your inbox monthly. Unsubscribe anytime.