[sf-perl] Catalyst question - sharing data between sessions

Garth Webb garth.webb at gmail.com
Wed Mar 25 10:27:12 PDT 2009


So I'm not clear about a few things.  You say that you want to share
some context between sessions.  Is this between two different user
sessions, or reload the same session for one user with all its data
more than once?  You also say that you clear the stash after every
request.  Does this mean you want to clear all the data?  This
wouldn't make sense for reloading the same session for a single user,
and if its multiple users they would only be able to share data if the
requests were happening simultaneously.

I *think* what you're asking for is the concept of persistent session
data that is available for a single user on every request they make.
This is pretty easy to setup on Catalyst:

  http://search.cpan.org/dist/Catalyst-Plugin-Session/lib/Catalyst/Plugin/Session/Tutorial.pod

If you want to share data between processes and don't want to incur
hits to your DB, maybe you want Memcached.

Garth

2009/3/25 Stefan Amshey <parallax99 at hotmail.com>:
> Hi all-
>
> I realize that this may not be the best list to ask this question on since
> it involves a specific Perl technology, but does anyone out there have some
> experience writing web-apps in Catalyst that could give me a basic point in
> the right direction regarding the following:
>
> I'm writing a web-app that needs to hold some large data structures, and
> instead of incurring the cost of loading those structures for each user
> session we'd like to store them in some context that is shared between
> sessions and possibly locked/unlocked/synchronized to avoid collisions.  The
> stash is cleared after every request, and the session object is
> user-specific.  Is there some concept of a "global session", or can we tie
> variables to the top-level Catalyst object, or something like that?  Anyone
> solved this problem before without resorting to writing files?
>
> Thanks!
>     /S
>
> - Stefan Amshey parallax99 at hotmail.com
>
>
> ________________________________
> Express your personality in color! Preview and select themes for Hotmail®.
> See how.
> _______________________________________________
> SanFrancisco-pm mailing list
> SanFrancisco-pm at pm.org
> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
>
>


More information about the SanFrancisco-pm mailing list