# Session confusion using mem\_cache\_store?

**URL:** <https://www.ruby-forum.com/t/session-confusion-using-mem-cache-store/187078>\
**Category:** Rails\
**Created:** [April 16, 2010, 4:48pm UTC](https://www.ruby-forum.com/t/session-confusion-using-mem-cache-store/187078 "2010-04-16T16:48:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![HSWade\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e19adc/32.png) [@HSWade\_M](https://www.ruby-forum.com/u/HSWade_M)\
**Post date:** [April 16, 2010, 4:48pm UTC](https://www.ruby-forum.com/t/session-confusion-using-mem-cache-store/187078/1 "2010-04-16T16:48:15Z")

</div>

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
