perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Swartz <SWA...@pobox.com>
Subject Re: writing CGI::Session sessions only when necessary
Date Wed, 27 Jan 2010 23:28:20 GMT
On Jan 27, 2010, at 2:45 PM, Perrin Harkins wrote:

> On Tue, Jan 26, 2010 at 7:42 PM, Jonathan Swartz <SWARTZ@pobox.com>  
> wrote:
>> On our site we create a new CGI::Session object at the beginning of  
>> the
>> request, so that it can be used anywhere in the web code.
>>
>> However, sessions are rarely written to, so at the end of the  
>> request I'd
>> like to avoid actually writing out a new session to backing store  
>> unless a
>> param actually got set.
>
> It might be simpler to just write immediately when you set a param.
> It's simple and foolproof, and it's only a negative for performance if
> you normally set multiple params in a single request.
>
> If your ultimate goal is to fix performance on your servers, I'd
> recommend looking at using encrypted data in a cookie and ditching
> server-side session storage.
>

True. My solution only involves a couple of lines of code, so it isn't  
going to get much simpler. It would just be ideal if I could use the  
public API. And this seems like an optimization that others might want.

Mime
View raw message