I was sick seeing that when using memcache for storing sessions, they
are suddenly disappearing when used in cluster environment. Users were
randomly logged out, orders in shopping cart emptied and so on...
I examined CGI::Session::MemCacheStore a little bit and found out
there is missing "add" call for the backend as there are only further
updates, and MemCache#set has this "Warning: Readers should not call
this method in the event of a cache miss; see MemCache#add."
After the patch below has been applied, the problem of disappearing
sessions is gone in my production environment.
I deleted all those silent discards of exceptions to let any problem
emerge. I also wrote couple of tests because there was no test case
for this store. These tests are skipped when memcache gem or server
connection is not available.
The patch is in ticket http://dev.rubyonrails.org/ticket/9823