如何使用dalli和Rails增加1MB以上的memcache slab大小?

我正在使用Ruby on Rails和dalli gem来使用memcache进行缓存。

默认值(键值存储中的值,即slab)最大大小为1MB。

我想把它增加到2MB。

dalli的文档说:

value_max_bytes: The maximum size of a value in memcached. Defaults to 1MB, this can be increased with memcached's -I parameter. You must also configure Dalli to allow the larger size here.

使用memcached-I选项,如何指定2MB? 是-I2还是-I2000? (文件不清楚)

对于dalli gem,我有environments/development.rb .rb

 config.cache_store = :dalli_store 

我没有明确提到Dalli :: Client.new那么如何设置value_max_bytes

我已经查看了stackoverflow上的相关问题 ,似乎我需要安装rack-cache gem。 这有必要吗?

谢谢。

使用以下命令启动memcached

 memcached -p 11211 -I2m 

在Rails环境文件中,例如config / environments / production.rb,使用以下语法:

 config.cache_store = :dalli_store, { value_max_bytes: 2000000 }