Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 3 在何处初始化Dalli::Client_Ruby On Rails 3_Memcached_Dalli - Fatal编程技术网

Ruby on rails 3 在何处初始化Dalli::Client

Ruby on rails 3 在何处初始化Dalli::Client,ruby-on-rails-3,memcached,dalli,Ruby On Rails 3,Memcached,Dalli,我刚刚开始使用Dalli gem进行内存缓存 我只是想知道,如果我想从缓存中获取一些数据,我是否需要在每个请求中创建一个Dalli::Client实例,或者我可以声明一个可以重用的单例?在您的配置/environments/production.rb中: config.cache\u store=:dalli\u storeconfig.cache\u store=:dalli\u store, 'cache-1.example.com',{:namespace=>RAILS\u应用程序的名称,

我刚刚开始使用Dalli gem进行内存缓存


我只是想知道,如果我想从缓存中获取一些数据,我是否需要在每个请求中创建一个Dalli::Client实例,或者我可以声明一个可以重用的单例?

在您的
配置/environments/production.rb中:

config.cache\u store=:dalli\u store
config.cache\u store=:dalli\u store, 'cache-1.example.com',{:namespace=>RAILS\u应用程序的名称, :expires_in=>1.day,:compress=>true}