Rails 2.3, cache_fu and the memcached session_store

Many Rails developers mistakenly assume that by installing defunkt’s cache_fu, Rails will be configured to use the settings found in the memcached.yml config YAML installed by the plugin. This was somehow true in earlier versions of Rails 2.*, but a couple of extra steps are required for 2.3.

Tim Connor’s branch has a commit that correctly sets the session_store config in Rails 2.3. I applied Tim’s patch to the most recent version of cache_fu:

http://github.com/jfernandez/cache_fu

If you’re also using Rails abstract cache_store (Rails.cache) and you want it to use the same settings as cache_fu, you will have to use the MemcachedConfig class. Just drop the class file in your RAILS_ROOT/lib folder and add the following code to your environment.rb file (or production.rb)

Now you have Rails 2.3 running with all Memcached stores configured under the same settings and namespace.

Notes

  1. josefernandez posted this