I have a Rails 2.3 application with about 45,000 active users. We
currently store sessions in the database with active_record_store.
I recently tested switching the session store to memcache, but within a
day of it running, we had a few users write in saying that they logged
in and saw other users’ data. I switched back to active record, no more
complaints. That reminded me that when I had tried this a year or so
ago, I’d seen a similar problem.
Does anyone have any idea why that might be happening? Here’s the
section I was using in config/environments/production.rb
require ‘memcache’
memcache_options = {
:compression => true,
:debug => false,
:namespace => :myapp,
:readonly => false,
:urlencode => false
}
CACHE = MemCache.new memcache_options
CACHE.servers = ‘localhost:11211’
ActionController::Base.session_options[:cache] = CACHE
config.action_controller.session_store = :mem_cache_store