【问题标题】:How to configure identity_cache gem to use dalli store?如何配置 identity_cache gem 以使用 dalli 商店?
【发布时间】:2013-06-16 08:57:31
【问题描述】:

找不到配置 identity_cache 以使用 dalli 的文档。谁能告诉我这是怎么做到的?

我在config/environments/development.rb 中尝试过(我想先在开发环境中尝试):

config.identity_cache_store = :mem_cache_store, ActiveSupport::Cache::DalliStore.new(servers: ["mem"])

当我启动rails时,我看到了这个错误:

uninitialized constant ActiveSupport::Cache::DalliStore (NameError)

【问题讨论】:

    标签: ruby-on-rails memcached dalli


    【解决方案1】:

    设置Dalli gem

    然后使用以下方法创建您的身份缓存存储:

    Dalli::Client.new
    

    ...所以你的 development.rb 文件将包含:

    config.action_controller.perform_caching = true
    config.cache_store = :dalli_store
    config.identity_cache_store = :dalli_store, Dalli::Client.new(:servers => ["mem1.server.com"])
    

    【讨论】:

      猜你喜欢
      • 2019-12-27
      • 2013-01-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-15
      • 1970-01-01
      相关资源
      最近更新 更多