Reputation: 386
What happens if config.cache_store in configuration evaluates to nil in Rails?
I have been looking at my Rails application and trying to optimize it in production (Details - nearly 2 years old, API only, Rails 5.0.7, deployed on AWS EC2 with Ubuntu 16.04 OS, using nginx and puma). We have multiple production instances with an Application Load Balancer attached.
I was surprised to see this line in my production.rb:
config.cache_store = :redis_store, ENV['REDIS_URL']
We haven't set up any Redis servers for caching. And sure enough, ENV['REDIS_URL']
was nil when I checked.
So, my question is - what happens in this situation? Is there no cache? Does it default to :file_store?
Upvotes: 0
Views: 2325
Reputation: 1133
use rails console in production to know which type of cache store is used
Rails.cache.class
I think in your case it will be ActiveSupport::Cache::NullStore
and this means no real cache you can know more about this type of store here
https://api.rubyonrails.org/classes/ActiveSupport/Cache/NullStore.html
Upvotes: 1