[cgiapp] Possible to avoid updating session last_access time ?

Ron Savage ron at savage.net.au
Thu Mar 3 17:55:54 EST 2011


Hi Richard

On Thu, 2011-03-03 at 22:32 +0000, Richard Jones wrote:
> On 03/03/2011 22:15, Ron Savage wrote:
> > Hi Richard
> >
> > If you switch to Data::Session, you can use $session ->  modified(0) in
> > the server's code to stop the session being saved:
> >
> > http://search.cpan.org/~rsavage/Data-Session-1.03/lib/Data/Session.pm#modified()
>  >
>  > Perhaps that will suffice.
> 
> Hello Ron,
> 
> Yes it looks like that scenario was considered during the construction 
> of Data::Session. I remember following the discussion on Data::Session 
> previously, but can't remember if it's a drop-in replacement for 
> CGI::Session - will have to trawl the archives. I'm using CAP::Session 
> anyway, so will need to see how much work is involved in making the 
> switch. Thanks for the suggestion.

It's /basically/ a drop-in. See specifically the docs pertaining
thereunto :-):

http://search.cpan.org/~rsavage/Data-Session-1.03/lib/Data/Session/CGISession.pm

If there are any issues, of course I'd be delighted to help.

> > On Thu, 2011-03-03 at 20:49 +0000, Richard Jones wrote:
> >> Hi all,
> >>
> >> I have an ajax function which polls the server every few minutes,
> >> looking for new messages for the logged in user. Unfortunately it's
> >> acting as a keep-alive for the session, as it effectively prevents the
> >> idle timeout duration ever being reached. I can't set the server poll
> >> frequency to a value higher than the idle timeout or it defeats the purpose.
> >>
> >> I'm using CAP::Session&  CAP::Authentication. If there is some way to
> >> avoid updating the CGI::Session _SESSION_ATIME and/or the
> >> CAP::Authentication AUTH_LAST_ACCESS values (not sure if both are
> >> effectively keeping the session alive), that would be good - a patch or
> >> an existing (undocumented) method? Maybe pass a runtime option to bypass
> >> updating the atime / last_access values?
> >>
> >> Otherwise I'll probably have to move the ajax function out of the app
> >> entirely, which would be a pity as it shares a lot of the app code.

-- 
Ron Savage
http://savage.net.au/
Ph: 0421 920 622



More information about the cgiapp mailing list