Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Extract AP Page and Action caching from Rails #7833

merged 4 commits into from

7 participants


This functionality will be available from actionpack-deprecated_caching gem.
The gem is currently hosted at

pd: I'm not sure about the name.





@rafaelfranca rafaelfranca commented on the diff
((27 lines not shown))
def setup
- FileUtils.rm_rf(File.dirname(FILE_STORE_PATH))
- FileUtils.mkdir_p(FILE_STORE_PATH)
- end
- def teardown
- FileUtils.rm_rf(File.dirname(FILE_STORE_PATH))
+ super
+ @store =
+ @controller =
@rafaelfranca Owner

Do we need all this setup?

@rafaelfranca Owner


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
((6 lines not shown))
include Sweeping if defined?(ActiveRecord)
included do
extend ConfigMethods
+ # Most Rails requests do not have an extension, such as <tt>/weblog/new</tt>.
+ # In these cases, the page caching mechanism will add one in order to make it
+ # easy for the cached files to be picked up properly by the web server. By
+ # default, this cache extension is <tt>.html</tt>. If you want something else,
+ # like <tt>.php</tt> or <tt>.shtml</tt>, just set Base.page_cache_extension.
+ # In cases where a request already has an extension, such as <tt>.xml</tt>
+ # or <tt>.rss</tt>, page caching will not add an extension. This allows it
+ # to work well with RESTful apps.
+ config_accessor :page_cache_extension
@rafaelfranca Owner

I think is better to rename this to default_static_extension

frodsan added a note

Ok, I'll ping you when it's done. Thanks <3!

@rafaelfranca Owner

We will need to add backward compatibility to page_cache_extension and deprecate it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

I'd like to understand the motivations behind moving this out of rails core. I had a brief exchange with @steveklabnik and understand that maybe developers should just be using Rack::Cache/Varnish + proper HTTP caching headers, but action caching also allows you hit your middleware and filter stack, which is useful for authentication.

I'm all for moving page caching out though, as it bypasses the Rails stack altogether.

dhh commented

Action caching relies on old-school manual expiration. No bueno. Much better to control your cache using key-based view and possibly controller based caches.

You're still free to use this through the plugin, but it's not a good fit for core any more. The state of the art moved on.


@frodsan lets move this forward.

Please add a CHANGELOG entry and update the upgrading guide talking about the removal and pointing to the plugin.

@rafaelfranca rafaelfranca merged commit b0a7068 into rails:master
@sgerrand sgerrand referenced this pull request from a commit in sgerrand/rails
@jroes jroes Refer to 37signals blog post for alternative
According to the rationale at rails#7833 (comment), we should recommend new users to follow DHH's approach outlined at

This is the first step, and perhaps in the future we can write some specific recommendations out.
@benja83 benja83 referenced this pull request from a commit in benja83/toyotakataboard-relational
@benja83 benja83