Memcache configuration for sessions

2 views
Skip to first unread message

Marcin Seroczynski

unread,
Mar 11, 2010, 3:38:58 AM3/11/10
to Ruby on Rails: Talk
Hello,

I've already got memcached running on desired machine by this command:
memcached -d -m 256 -u nobody -p 11211

My configuration is placed in /config/enviroments/production.rb
http://pastie.org/863178

But still memcache session store uses default configuration which is
described in API Class:
ActionController::Session::MemCacheStore
(http://railsapi.com/doc/rails-v2.3.5/classes/ActionController/Session/
MemCacheStore.html - check source and @default_options, lines 13-16)

Could anyone tell me how to properly pass those configuration for
memcache sessions?

Best,
Martin

Marcin Seroczynski

unread,
Mar 11, 2010, 6:10:06 AM3/11/10
to Ruby on Rails: Talk
Hello,

I have found an solution and wanted to share:
http://pastie.org/864771

Now my question is... why do I have to declare a new MemCache object
to pass it to sessions?
Why rails by default don't uses already configured memcache object
from:
config.action_controller.session_store = :mem_cache_store

We should be able to do something like this:
config.action_controller.session_store = :mem_cache_store, "localhost:
11212"

Any ideas?

Best,
Martin

On 11 Mar, 09:38, Marcin Seroczynski <sere...@gmail.com> wrote:
> Hello,
>
> I've already got memcached running on desired machine by this command:
> memcached -d -m 256 -u nobody -p 11211
>

> My configuration is placed in /config/enviroments/production.rbhttp://pastie.org/863178

Reply all
Reply to author
Forward
0 new messages