Has anyone gotten memcached to work with a mongrel cluster before? I
see
numerous posts on the internet of people who can’t get this to work, and
no
one saying it does.
Do these two technologies work together?
(Note: I say mongrel cluster. I know memcached works with a single
mongrel
instance).
Hurm, that suggests its a configuration issue. Could I take a look at
the
memcache lines you added for environment.rb please?
I’m using the “vanilla” ones posted on many blogs. Tried with both
clients
to no avail. I’m currently reading through the verbose debug from
Ruby-MemCache in the hope of spotting something…
OK, I did some debugging of Rails, and I think the answer is to do with
the
way Rails uses sessions. The mem_cache session store is actually
serialised
outside of the Rails framework, which means that it cannot instantiate
ActiveRecord objects upon load. This is different to the file_session
storage which is part of Rails.
This means that if you store ActiveRecord objects in your session, there
is
a good chance your application will not work with memcached. I’m
guessing
you opt for the more traditional route and only store IDs in the
session.
Different options at this point are to add additional extensions to the
CGI:Session object (serialising everything as a string upon save and
load)
so that mem_cache_session will work, changing the application to use
object
IDs rather than objects in the session, or going back to file based
sessions
and adding some kind of mutex so they will work with mongrel clusters.