Persistent objects belong in the session or db. Session based object
persistence is transparent and painless. Yes, objects survive
multiple requests within a fastcgi process, but fastcgi can spawn
multiple processes and it''s not guaranteed that a particular user will
always be served by the same one. Besides--if you designed to depend
on persistence even on one machine, what would happen if you needed to
cluster later? I''d put the sessions in the db, even, so
there''s no
dependence on server setup at all.
Webrick is not fit for production scenarios and what it does with
objects on each request is probably more dependent on environment.rb
than webrick itself. Note that rails rebuilds controller/view objects
on each request anyways, so storing things in the controller is not
going to give you persistence (with any setup) unless you''re using the
session member of the controller (which stores files on the disk/db
depending on configuration).
Brian
On 5/10/05, Steven Chan
<smellicus-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi all,
>
> Coming from the PHP world where all objects are destroyed at the end of
> each request, I am somewhat confused about what RoR on fastcgi does? Is it
> possible to persist objects between requests?
>
> For example, let''s say I have a simple counter object that just
increments
> everytime someone visits a page on my webapp. Will this persist when using
> RoR with fastcgi? And how would I go about making it persist?
>
> Is persistence possible with Webrick? I read somewhere that Webrick
creates
> all objects on each request.
>
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
>
>
--
The years ahead pick up their dark bags.
They move closer. There''s a slight rise in the silence
then nothing.
--
(If you''re receiving this in response to mail sent to
bluczkie-OM76b2Iv3yLQjUSlxSEPGw@public.gmane.org, don''t be concerned
This is my new address,
but mail will be forwarded here indefinitely)