Hi,
I wondered how sessions are stored in rails, and if it can be tailored.
I'm a cgikit user as everyone knows by now and I like the way how this is abstracted: you can write your own session storing class and tell your app to use it. Is this possible (or something similar) with Rails? I looked at the doc but only saw a reference to a drb session daemon. (did I miss the right place in the doc?)
The reason I'm interested in such a thing is that I thought (but I didn't test it yet) that it would let me integrate cgikit (and possibly rails) developments in an existing PHP application eg.
thanks.
Raph
Bauduin Raphael wrote:
Hi,
Moin!
I wondered how sessions are stored in rails, and if it can be tailored.
As far as I know CGI::Session is used for this.
I'm a cgikit user as everyone knows by now and I like the way how this is abstracted: you can write your own session storing class and tell your app to use it. Is this possible (or something similar) with Rails? I looked at the doc but only saw a reference to a drb session daemon. (did I miss the right place in the doc?)
Have a look at cgi/session.rb in your ruby library directory -- there should be two sample session types in there already. (FileStore and MemoryStore)
thanks.
Raph
Regards,
Florian Gross
I'm a cgikit user as everyone knows by now and I like the way how this is abstracted: you can write your own session storing class and tell your app to use it. Is this possible (or something similar) with Rails? I looked at the doc but only saw a reference to a drb session daemon. (did I miss the right place in the doc?)
Rails uses CGI::Session and will take any store for that. By default it uses the PStore, which is a file-based store that uses Marshal to allow all kinds of objects in it. It's very easy to use and scale, but unfortunately it's also quite slow. In some benchmarks I did, it was responsible for a 50% speed decrease over other methods, such as the MemoryStore.
You can specify another Store than the default in the dispatcher. Have a look at vendor/railties/dispatcher.rb.
On that note, does anyone have a database store for CGI::Session? It would be nice to ship that with Rails as an option.
路路路
--
David Heinemeier Hansson,
http://www.rubyonrails.org/ -- Web-application framework for Ruby
http://www.instiki.org/ -- A No-Step-Three Wiki in Ruby
http://www.basecamphq.com/ -- Web-based Project Management
http://www.loudthinking.com/ -- Broadcasting Brain
http://www.nextangle.com/ -- Development & Consulting Services
David Heinemeier Hansson wrote:
On that note, does anyone have a database store for CGI::Session? It would be nice to ship that with Rails as an option.
I already told you I'd send you my CGI::Session::ActiveRecordStore. See off-list.
Tim.
路路路
--
Tim Bates
tim@bates.id.au
I'd like to see a Drb-based store, so that you could have the speed of
memory-based access along with the ability to have a dedicated session
server for seamless failover of webservers behind a hardware load
balancer.
Carl
路路路
On Wed, 28 Jul 2004 08:21:55 +0900, Tim Bates <tim@bates.id.au> wrote:
David Heinemeier Hansson wrote:
> On that note, does anyone have a database store for CGI::Session? It
> would be nice to ship that with Rails as an option.
I already told you I'd send you my CGI::Session::ActiveRecordStore. See
off-list.
Tim.
--
Tim Bates
tim@bates.id.au
On that note, does anyone have a database store for CGI::Session? It would be nice to ship that with Rails as an option.
I already told you I'd send you my CGI::Session::ActiveRecordStore. See off-list.
I apologies for my forgetfullness. Marvelous job, Bates. It'll certainly make the upcoming 0.7.6 release!
路路路
--
David Heinemeier Hansson,
http://www.rubyonrails.org/ -- Web-application framework for Ruby
http://www.instiki.org/ -- A No-Step-Three Wiki in Ruby
http://www.basecamphq.com/ -- Web-based Project Management
http://www.loudthinking.com/ -- Broadcasting Brain
http://www.nextangle.com/ -- Development & Consulting Services
By the way, Ara Howard suggested a really simple Drb session daemon to
me earlier:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/88815
Only I was having problems with it that I couldn't quite figure out.
Carl
路路路
On Tue, 27 Jul 2004 16:28:50 -0700, Carl Youngblood <carl.youngblood@gmail.com> wrote:
I'd like to see a Drb-based store, so that you could have the speed of
memory-based access along with the ability to have a dedicated session
server for seamless failover of webservers behind a hardware load
balancer.
Carl
On Wed, 28 Jul 2004 08:21:55 +0900, Tim Bates <tim@bates.id.au> wrote:
> David Heinemeier Hansson wrote:
> > On that note, does anyone have a database store for CGI::Session? It
> > would be nice to ship that with Rails as an option.
>
> I already told you I'd send you my CGI::Session::ActiveRecordStore. See
> off-list.
>
> Tim.
>
> --
> Tim Bates
> tim@bates.id.au
>
>
I'd like to see a Drb-based store, so that you could have the speed of
memory-based access along with the ability to have a dedicated session
server for seamless failover of webservers behind a hardware load
balancer.
It's already there!
Have a look in vendor/actionpack/cgi_ext -- there's both a server and a client (Session store). Works great too and it's pretty fast.
路路路
--
David Heinemeier Hansson,
http://www.rubyonrails.org/ -- Web-application framework for Ruby
http://www.instiki.org/ -- A No-Step-Three Wiki in Ruby
http://www.basecamphq.com/ -- Web-based Project Management
http://www.loudthinking.com/ -- Broadcasting Brain
http://www.nextangle.com/ -- Development & Consulting Services