Setting the cache_store in an initializer

前端 未结 6 823
一向
一向 2020-12-05 10:38

I\'m trying to use redis-store as my Rails 3 cache_store. I also have an initializer/app_config.rb which loads a yaml file for config settings. In my initializer/redis.rb I

6条回答
  •  无人及你
    2020-12-05 11:14

    I tried the following and it works out.

    MyApp::Application.config.cache_store = :redis_store
    self.class.send :remove_const, :RAILS_CACHE if self.class.const_defined? :RAILS_CACHE
    RAILS_CACHE = ActiveSupport::Cache.lookup_store(MyApp::Application.config.cache_store)
    

提交回复
热议问题