Rails memcache. Как правильно установить «limit_maxbytes»?

memcahed -I 64M
Rails.cache.stats
=> {"127.0.0.1:11211"=>
  {"pid"=>"5790",
   "uptime"=>"248",
   "time"=>"1401954461",
   "version"=>"1.4.14 (Ubuntu)",
   "libevent"=>"2.0.21-stable",
   "pointer_size"=>"32",
   "rusage_user"=>"0.228000",
   "rusage_system"=>"0.220000",
   "curr_connections"=>"11",
   "total_connections"=>"13",
   "connection_structures"=>"12",
   "reserved_fds"=>"20",
   "cmd_get"=>"19",
   "cmd_set"=>"15",
   "cmd_flush"=>"0",
   "cmd_touch"=>"0",
   "get_hits"=>"5",
   "get_misses"=>"14",
   "delete_misses"=>"1",
   "delete_hits"=>"0",
   "incr_misses"=>"0",
   "incr_hits"=>"0",
   "decr_misses"=>"0",
   "decr_hits"=>"0",
   "cas_misses"=>"0",
   "cas_hits"=>"0",
   "cas_badval"=>"0",
   "touch_hits"=>"0",
   "touch_misses"=>"0",
   "auth_cmds"=>"0",
   "auth_errors"=>"0",
   "bytes_read"=>"24141",
   "bytes_written"=>"1704",
   "limit_maxbytes"=>"67108864",
   "accepting_conns"=>"1",
   "listen_disabled_num"=>"0",
   "threads"=>"4",
   "conn_yields"=>"0",
   "hash_power_level"=>"16",
   "hash_bytes"=>"262144",
   "hash_is_expanding"=>"0",
   "expired_unfetched"=>"0",
   "evicted_unfetched"=>"0",
   "bytes"=>"23203",
   "curr_items"=>"14",
   "total_items"=>"15",
   "evictions"=>"0",
   "reclaimed"=>"0"}}

Видно, что limit_maxbytes = 64 мегабайта.
Но записать объект размером 4 мегабайта не могу. Ни в консоли ни на сервере (перезапускал и то и другое)
Через веб:
Value for Test over max size: 1048576 <= 4116715
В консоли просто пишет false.
Вызываю, собственно, вот чем:
Rails.cache.fetch('Test'){ Spree::Product.all }.count.to_s

Rails 3.2
Ruby 2.1.1
Dalli
Memcachier
  • Вопрос задан
  • 2948 просмотров
Решения вопроса 1
Vakiliy
@Vakiliy
memcahed -m 64M -I 10M

config.cache_store = :dalli_store, {:value_max_bytes => 10.megabytes}


Rails.cache.fetch('10mb'){ 'x' * 10.megabytes }.size
Cache read: 10mb
Cache generate: 10mb
Cache write: 10mb
Value for 10mb over max size: 10485760 <= 10485773


Rails.cache.fetch('9mb'){ 'x' * 9.megabytes }.size
Cache read: 9mb
Cache fetch_hit: 9mb
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы