My application has a feature that allows the administrator can change the cache_store configuration via a GUI. Then the new configuration will take effect right away.
The default cache_store in my production.rb:
config.cache_store = :memory_store
The admin can optionally change to use memcached with Dalli store. I tried to change Rails.application.config.cache_store:
Rails.application.config.cache_store = :dalli_store, 'localhost:11211', 'localhost:11212'
But the Rails.cache does not change:
Rails.cache
=> <#ActiveSupport::Cache::MemoryStore entries=0, size=0, options={}>
Is there anyway to do this?