我試圖在我的Rails應用程序的cache_store配置中設置maxmemory
和maxmemory-policy
。Rails Redis設置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,但它沒有給出任何示例。
我也克隆和grepped maxmemory
在redis-rb
寶石(https://github.com/redis/redis-rb),但沒有出現。所以看起來它還沒有實施。
呀之後,我問我通過自己的代碼讀取的問題,並且意識到他們沒有實現maxmemory&maxmemory政策然而。在我問這個問題之前,我並不是100%肯定的。感謝您的迴應。 – Matilda