【发布时间】:2013-07-06 10:39:22
【问题描述】:
我正在尝试在我的 Rails 应用程序的 cache_store 配置中设置 maxmemory 和 maxmemory-policy。
我在 production.rb 文件中做了以下操作:
redis_url = "redis://localhost:6379/0"
config.cache_store = :redis_store, redis_url, { :expires_in => 4.weeks ,
:namespace => 'rails-cache',
:maxmemory => '25gb',
'maxmemory-policy' => 'volatile-ttl'}
但 maxmemory 似乎无法正常工作。当我做Rails.cache.methods 时,我没有得到任何关于memory 或max 的方法。
我在网上没有看到 Rails 的任何示例,最接近的是 handling redis maxmemory situations with rails when using rails caching,但它没有给出任何示例。
我还在redis-rb gem (https://github.com/redis/redis-rb) 中克隆并搜索了maxmemory,但没有出现任何结果。所以好像还没有实现。
【问题讨论】:
标签: ruby-on-rails ruby caching redis