Skip Menu |
 

This queue is for tickets about the CGI-Session CPAN distribution.

Report information
The Basics
Id: 51191
Status: rejected
Priority: 0/
Queue: CGI-Session

People
Owner: MARKSTOS [...] cpan.org
Requestors: rpv [...] nikolas.ru
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Feature request: send session etime to driver->store()
Date: Sun, 8 Nov 2009 00:17:05 +0600
To: bug-CGI-Session [...] rt.cpan.org
From: "Pavel V. Rochnyack" <rpv [...] nikolas.ru>
Download (untitled) / with headers
text/plain 1.6k
Hi all! I want to propose a new feature: allow get session expire time in driver module. This allow to remove expired sessions from storage without loading them, or will be very useful then storing sessions in memcached. Patch can look like example below: --- CGI/Session.pm.orig<--->2009-03-21 07:59:06.000000000 +0600 +++ CGI/Session.pm<>2009-11-07 23:35:51.000000000 +0600 @@ -250,7 +250,9 @@ unless ( defined $datastr ) { return $self->set_error( "flush(): couldn't freeze data: " . $serializer->errstr ); } - defined( $driver->store($self->id, $datastr) ) or + my $etime = undef; + $etime = time() + $self->{_DATA}->{_SESSION_ETIME} if ($self->{_DATA}->{_SESSION_ETIME}); + defined( $driver->store($self->id, $datastr, $etime) ) or return $self->set_error( "flush(): couldn't store datastr: " . $driver->errstr); $self->_unset_status(STATUS_NEW | STATUS_MODIFIED); } Feature usage example: driver_memcached.patch [----] 0 L:[ 1+ 0 1/ 18] *(0 / 483b)= - 45 0x2D --- CGI/Session/Driver/memcached.pm.orig<->2009-09-11 18:19:22.000000000 +0700 +++ CGI/Session/Driver/memcached.pm<------>2009-11-07 23:24:16.000000000 +0600 @@ -35,12 +35,12 @@ . sub store { my $self = shift; - my ($sid, $datastr) = @_; + my ($sid, $datastr,$etime) = @_; croak "store(): usage error" unless $sid && $datastr; . #warn "store(): sid=$sid, $datastr\n"; my $memcached = $self->{Memcached}; - $memcached->set($sid, $datastr); + $memcached->set($sid, $datastr,$etime); . return 1; } -- Best regards, Pavel V. Rochnyack mailto:rpv@nikolas.ru
Subject: Re: [rt.cpan.org #51191] Feature request: send session etime to driver->store()
Date: Mon, 9 Nov 2009 09:41:14 -0500
To: bug-CGI-Session [...] rt.cpan.org
From: Mark Stosberg <mark [...] summersault.com>
Download (untitled) / with headers
text/plain 412b
Show quoted text
> I want to propose a new feature: allow get session expire time in > driver module. This allow to remove expired sessions from storage > without loading them, or will be very useful then storing sessions > in memcached. Patch can look like example below:
Pavel, Thanks for the suggestion. Is it your understanding that this feature would be backwards compatible with existing code and drivers? Mark
On Sat Nov 07 13:17:34 2009, rpv@nikolas.ru wrote: Show quoted text
> Hi all! > > I want to propose a new feature: allow get session expire time in > driver module. This allow to remove expired sessions from storage > without loading them, or will be very useful then storing sessions > in memcached.
Thanks for the suggestion. I think this patch confuses the design, since CGI::Session already manages deleting expired sessions. What about having a driver option that allows to set an expiration time there? It would apply to all objects set through the driver, and should be longer than any expiration time the objects set themselves. Also, this case is unusual in that Memcached appears to provide no way to traverse its objects, which is part of how other drivers users clean up their expired sessions. It's still possible that we could add the requested feature, I just think it merits some further consideration about alternatives. Discussing it on the Users mailing list seems useful. I'm sorry for extremely long delay in responding to this. Mark
Closing due to lack of follow-up.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.