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
--
Kamil Kukura