Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我刚刚开始使用 Dalli gem 进行内存缓存。
我只是想知道如果我想从缓存中获取一些数据或者我可以声明一个可以重用的单例,我是否需要在每个请求中创建一个 Dalli::Client 的实例?
在你的config/environments/production.rb:
config/environments/production.rb
config.cache_store = :dalli_store config.cache_store = :dalli_store, 'cache-1.example.com', { :namespace => NAME_OF_RAILS_APP, :expires_in => 1.day, :compress => true }