Skip to content
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

Use Rack::Cache middleware only if is in Gemfile #7794

Merged
merged 2 commits into from Oct 2, 2012

Conversation

guilleiguaran
Copy link
Member

This being discussed by Rails core right now, IMO this PR is a fair solution, if the user want to use rack-cache then it should be specified in Gemfile explicitly

@guilleiguaran
Copy link
Member Author

should we add rack-cache to default generated Gemfile? (commented or uncommented?)

@@ -9,6 +9,10 @@ source 'https://rubygems.org'
<%= assets_gemfile_entry %>
<%= javascript_gemfile_entry %>

# Rack::Cache enables HTTP caching on your app
# Varnish/Squid are recommended for big apps
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if you have ideas about a better message

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To put a simple HTTP cache in front of your app, add rack-cache to your bundle and set config.action_dispatch.rack_cache = true.
For large-scale production use, consider using nginx, varnish, or squid as caching reverse proxies.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeremy should we add config.action_dispatch.rack_cache = true to default production.rb (commented/uncommented?) or leave it as hidden option?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably leave it out. If we extract a rack-cache-rails plugin, can talk about config in its docs.

@spastorino
Copy link
Contributor

I'm OK with the change, I prefer moving all the rack-cache related code to rack-cache itself or to rack-cache-rails though. We could merge this first and then start working on that. What do you think @guilleiguaran ?.

@rtomayko is it possible to add a railtie and all the glue code we need to rack-cache itself? or should we start thinking about a rack-cache-rails gem?, which has all the glue code + rack-cache as a dependency ala sass-rails

@rtomayko
Copy link
Contributor

@rtomayko is it possible to add a railtie and all the glue code we need to rack-cache itself? or should we start thinking about a rack-cache-rails gem?, which has all the glue code + rack-cache as a dependency ala sass-rails

Seems reasonable to me. If it's all new code I can get a release out quickly.

@barttenbrinke
Copy link
Contributor

I never really understood why rails dependent on it by default. After issues like rtomayko/rack-cache#52 I have disabled rack-cache disabled for my biggest projects by default anyway.
This would be a much cleaner solution then the current initializer hack i'm using.

@rafaelfranca
Copy link
Member

Seems fine to me 👍

spastorino added a commit that referenced this pull request Oct 2, 2012
Use Rack::Cache middleware only if is in Gemfile
@spastorino spastorino merged commit 037e50e into rails:master Oct 2, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants