My application has a feature that allows the administrator to change the cache_store configuration using a graphical interface. Then the new configuration will take effect immediately.
By default cache_store in my production.rb:
config.cache_store = :memory_store
An administrator can optionally change the use of memcached with the Dalli repository. I tried changing Rails.application.config.cache_store:
Rails.application.config.cache_store = :dalli_store, 'localhost:11211', 'localhost:11212'
But Rails.cache does not change:
Rails.cache => <#ActiveSupport::Cache::MemoryStore entries=0, size=0, options={}>
Is there any way to do this?
source share