perl-asp mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Josh Chamas <j...@chamas.com>
Subject Re: session data slowdown
Date Fri, 06 Jun 2003 17:08:46 GMT
raystormphd wrote:
>
> data1=$Session->{'key1'}
> data2=$Session->{'key2'}
> data3=$Session->{'key3'}
> 
> Does each statement cause a freeze/thaw of the whole Session data
> structure to/from disk?
>

No, each one does its own freeze/thaw just for that key / value pair.

> In your code, you make one read only copy.  Does this cause only one
> thaw?  This is why your proposed trick would help, right?
> 

The idea behind that is if you are just using it to look up lots of
global values & db data, which is not recommended anyway, you might
just init an in memory hash to reference in your code instead of
going to the $Session each time, so perhaps better to...

   $Session->Lock;
   $SessionCopy = { %$Session };
   $Session->UnLock;
      ...
   $SessionCopy->{KEY};
   $SessionCopy->{KEY};
   $SessionCopy->{KEY};

than to:

   $Session->{KEY}
   $Session->{KEY}
   $Session->{KEY}

but really better is to do this...

   my $value = $Session->{KEY};
   $value;
   $value;

Like I said, a lot of it depends on how you are programming.  But overall,
you want to make as few calls getting as little data from $Session as possible.

Regards,

Josh

________________________________________________________________
Josh Chamas, Founder                   phone:925-552-0128
Chamas Enterprises Inc.                http://www.chamas.com
NodeWorks Link Checking                http://www.nodeworks.com


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Mime
View raw message