Skip to content

Extract AP Page and Action caching from Rails #7833

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 4, 2012
11 changes: 11 additions & 0 deletions actionpack/CHANGELOG.md
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 `README.md` 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'
end
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
end

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

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

This file was deleted.

Loading