Skip to content


Merge pull request #7833 from frodsan/extract_ap_pages_actions_caching
Browse files Browse the repository at this point in the history
Extract AP Page and Action caching from Rails
  • Loading branch information
rafaelfranca committed Oct 4, 2012
2 parents 7d204ed + ea042ba commit b0a7068
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 1,138 deletions.
11 changes: 11 additions & 0 deletions actionpack/
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
## Rails 4.0.0 (unreleased) ##

* `ActionController::Base.page_cache_extension` option is deprecated
in favour of `ActionController::Base.default_static_extension`.

*Francesco Rodriguez*

* Action and Page caching has been extracted from Action Dispatch
as `actionpack-action_caching` and `actionpack-page_caching` gems.
Please read the `` file on both gems for the usage.

*Francesco Rodriguez*

* Failsafe exception returns text/plain. *Steve Klabnik*

* Remove actionpack's rack-cache dependency and declare the
Expand Down
24 changes: 16 additions & 8 deletions actionpack/lib/action_controller/caching.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
require 'uri'
require 'set'

module ActionController #:nodoc:
module ActionController
# \Caching is a cheap way of speeding up slow applications by keeping the result of
# calculations, renderings, and database calls around for subsequent requests.
# Action Controller affords you three approaches in varying levels of granularity:
# Page, Action, Fragment.
# You can read more about each approach and the sweeping assistance by clicking the
# modules below.
Expand All @@ -17,8 +15,7 @@ module ActionController #:nodoc:
# == \Caching stores
# All the caching stores from ActiveSupport::Cache are available to be used as backends
# for Action Controller caching. This setting only affects action and fragment caching
# as page caching is always written to disk.
# for Action Controller caching.
# Configuration examples (MemoryStore is the default):
Expand All @@ -32,9 +29,7 @@ module Caching
extend ActiveSupport::Autoload

eager_autoload do
autoload :Actions
autoload :Fragments
autoload :Pages
autoload :Sweeper, 'action_controller/caching/sweeping'
autoload :Sweeping, 'action_controller/caching/sweeping'
Expand All @@ -58,12 +53,25 @@ def cache_configured?
include AbstractController::Callbacks

include ConfigMethods
include Pages, Actions, Fragments
include Fragments
include Sweeping if defined?(ActiveRecord)

included do
extend ConfigMethods

config_accessor :default_static_extension
self.default_static_extension ||= '.html'

def self.page_cache_extension=(extension)
ActiveSupport::Deprecation.deprecation_warning(:page_cache_extension, :default_static_extension)
self.default_static_extension = extension

def self.page_cache_extension
ActiveSupport::Deprecation.deprecation_warning(:page_cache_extension, :default_static_extension)

config_accessor :perform_caching
self.perform_caching = true if perform_caching.nil?
Expand Down
189 changes: 0 additions & 189 deletions actionpack/lib/action_controller/caching/actions.rb

This file was deleted.


0 comments on commit b0a7068

Please sign in to comment.