Re: writing CGI::Session sessions only when necessary
Jonathan Swartz <[email protected]>
| Newsgroups | gmane.comp.apache.mod-perl |
|---|---|
| Message-ID | <[email protected]> |
On Jan 27, 2010, at 2:45 PM, Perrin Harkins wrote: > On Tue, Jan 26, 2010 at 7:42 PM, Jonathan Swartz <[email protected]> > 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.