Forum: Ruby on Rails How to use mem_cache_store?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
3a83969376c805ef5b6042191fdb0ff3?d=identicon&s=25 Andreas S. (andreas)
on 2005-12-25 16:06
Hi,

I'm trying to use mem_cache_store for sessions. I have installed the
server and the gem and have added the following to my
config/environment.rb:

>>>>>>>>>>>>>>>>>>>>>>>>>
memcache_options = {
   :c_threshold => 10_000,
   :compression => true,
   :debug => false,
   :namespace => 'ruby-forum.com',
   :readonly => false,
   :urlencode => false
}

CACHE = MemCache.new memcache_options
CACHE.servers = 'localhost:11211'

session_options = {
   :database_manager => CGI::Session::MemCacheStore,
   :cache => CACHE,
   :session_domain => 'ruby-forum.com'
}

ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update
session_options
<<<<<<<<<<<<<<<<<<<<<<<<<

Bur Rails still uses the session table in the database. Is there
anything else I have to do to in order to make this work?

Thanks
Andreas
3a83969376c805ef5b6042191fdb0ff3?d=identicon&s=25 Andreas S. (andreas)
on 2005-12-30 21:12
Andreas S. wrote:
> Bur Rails still uses the session table in the database. Is there
> anything else I have to do to in order to make this work?

Stupid. I had a manual setting for ActiveRecordStore somewhere else in
my app.

That's all it needs to use MemCacheStore:
config.action_controller.session_store = :mem_cache_store
This topic is locked and can not be replied to.