There are currently two problems with storing ActiveRecord objects in memcached.
The Undefined Class/Module problem (Google search). From what I've read up, this is still a bug that nobody has a real good solution for. The cache_fu plugin has probably the best solution for this, wrapping its retrieve call in a block that tries to catch this error, parses the message and tries to load the undefined class/module.
The infamous LH ticket #1339 (LH Ticket). This bug will only happen when you have cache_classes set to FALSE (development, test).
After googling for weeks, I still haven't found a good technique for storing AR instances in memcached without having to deal with the 2 issues listed above.
The idea I haven't tried yet is removing the attributes from the instance as strings (just how AR receives them from the DB before it does its type casting), storing those in memcached and then on retrieval from the cache, somehow instantiate an AR object using these values. Is this possible? If so, what is the best way to do it?
I'm just looking for ways other Rails developers have tackled this problem.
In our projects we store the object as XML.
There is some extra cost for serializing/de-serializing XML. But this has enabled us to share the cache amongst non Ruby apps.