[Catalyst] Updating many sessions at once?

James Spath jspath at snapapp.com
Mon May 20 20:04:44 GMT 2013

Are there any pitfalls to updating many Catalyst sessions at once using the
following code?

    while ( my $session =3D $sessions->next ) {

      my $session_key =3D 'session:' . $session->{'_id'};
      my $session_data =3D $catalyst->get_session_data($session_key);

      @{$session_data}{ keys %$data } =3D values %$data;

      $catalyst->update_session_data($session_key, $session_data);


This is using MongoDB as the session store.

Obviously there is the small gap between retrieving the session data and
updating it, but are any traps here that I am not aware of?

Is there a better way to do this?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20130520/254a1=

More information about the Catalyst mailing list