On Tue, Jan 26, 2010 at 7:42 PM, Jonathan Swartz <swa...@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. - Perrin