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
Conversation
|
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 | |||
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
|
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 |
Seems reasonable to me. If it's all new code I can get a release out quickly. |
|
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. |
|
Seems fine to me |
Use Rack::Cache middleware only if is in Gemfile
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