Flowdock

Notes posted by dvrensk

RSS feed
November 2, 2009
0 thanks

To use the memcached gem

If you use the mem_cache_store it will use “memcache-client” to talk to the actual cache. memcache-client is a pure Ruby library that is bundled with rails. There is a Ruby/C library called “memcached” that uses native bindings to talk to memcache, and it is reportedly (http://blog.evanweaver.com/files/doc/fauna/memcached/files/README.html) up to a 100 times faster than memcache-client. To use that instead,

# in shell
$ sudo gem install memcached --no-rdoc --no-ri

# in config/production.rb
require 'memcached'
config.action_controller.cache_store =
  :mem_cache_store, Memcached::Rails.new("localhost:11211")

This feature (to pass a configured MemCache-like object to cache_store=) is available since rails 2.3.3 and will hopefully be documented in 2.3.5.