jbd-ARXITx83Qt49fbuuu1rVSg@public.gmane.org
2005-Aug-05 20:16 UTC
specifying options to session stores
Hey all, I''m experimenting with different session stores, and I haven''t found any documentation on the slightly more advanced setups. Specifically, how does one pass options into the initialize() methods of the stores themselves? I would imagine something like :database_manager_options would be part of DEFAULT_SESSION_OPTIONS, but I haven''t been able to find such a thing. Examples of how this would be useful: remote DRbstore for sessions and fragment caching a separate database server for sessions (on a remote machine) a memcached farm not hosted on the webserver serving the site I''ve read all the relevant source code, and I see the options available to the stores, but I don''t see how I can pass them in via Rails. Clues? -- Justin Dossey
On Fri, 5 Aug 2005, jbd-ARXITx83Qt49fbuuu1rVSg@public.gmane.org wrote:> Hey all, > > I''m experimenting with different session stores, and I haven''t found > any documentation on the slightly more advanced setups. > > Specifically, how does one pass options into the initialize() methods > of the stores themselves? I would imagine something like > : database_manager_options would be part of DEFAULT_SESSION_OPTIONS, > but I haven''t been able to find such a thing. > > Examples of how this would be useful: > > remote DRbstore for sessions and fragment caching > a separate database server for sessions (on a remote machine) > a memcached farm not hosted on the webserver serving the site > > I''ve read all the relevant source code, and I see the options > available to the stores, but I don''t see how I can pass them in via > Rails. > > Clues? > >Finally, I found the option. For any of you who try saving sessions to a central location or offloading session fu: ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update( :database_manager => CGI::Session::MemCacheStore, :cache => MemCache.new(''cacheserver.mydomain.tld'') ) Note that this still doesn''t give us the full range of configurability in memcached (or even the ability to specify multiple servers). Also note that the DRbStore has the DRb server location hard coded in actionpack-1.7.0/lib/action_controller/session/drb_store.rb. No option there. -- Justin