Rails.cache error in Rails 3.1 – TypeError: can’t dump hash with default proc

This might be a little verbose but I had to spend some time with the Rails source code to learn how the caching internals work. Writing things down aids my understanding and I figure that sharing some notes on how things work can’t hurt. Skip to the end if you’re in a hurry. Why It … Read more

Is the ruby operator ||= intelligent?

This is extremely easy to test: class MyCache def initialize @hash = {} end def []=(key, value) puts “Cache key ‘#{key}’ written” @hash[key] = value end def [](key) puts “Cache key ‘#{key}’ read” @hash[key] end end Now simply try the ||= syntax: cache = MyCache.new cache[“my key”] ||= “my value” # cache value was nil … Read more

Is it recommended to store PHP Sessions in MemCache?

1: YES. And I strongly recommend storing PHP sessions in Memcached. Here’s why: Memcached is great for storing small chunks of data that are frequently accessed by the database and filesystem. Memcached was designed specifically for sessions. It was originally the brainchild of the lead developer of livejournal.com and later used to also cache the … Read more

Can I get Memcached running on a Windows (x64) 64bit environment?

North Scale labs have released a build of memcached 1.4.4 for Windows x64: http://blog.couchbase.com/memcached-windows-64-bit-pre-release-available http://labs.northscale.com/memcached-packages/ UPDATE: they have recently released Memcached Server – still FREE but enhanced distro with clustering, web-based admin/stats UI etc. (I’m not related to them in any way) Check it out at http://northscale.com/products/memcached.html and download at: http://www.northscale.com/download.php?a=d UPDATE 2: NorthScale Memcached … Read more

When should I use Memcache instead of Memcached?

Memcached client library was just recently released as stable. It is being used by digg ( was developed for digg by Andrei Zmievski, now no longer with digg) and implements much more of the memcached protocol than the older memcache client. The most important features that memcached has are: Cas tokens. This made my life … Read more