[ic] Expire Sessions Selectively

Mike Heins mike at perusion.com
Wed Jun 30 14:21:21 EDT 2004


Quoting Bill Carr (bill at worldwideimpact.com):
> On Mon, 2004-06-28 at 16:00 -0400, Mike Heins wrote:
> > Quoting Bill Carr (bill at worldwideimpact.com):
> > > Hello,
> > > 
> > > IC 5.2, file sessions
> > > 
> > > I would like to be able to keep sessions around for a longer period of
> > > time if the session contains a shopping cart with items.
> > > 
> > > Is there a way to do this with Interchange?
> > 
> > Not at this time.
> > 
> > > 
> > > If not, does any one have any hints about how I could do this?
> > 
> > You could set SessionExpire to what you want for the sessions with
> > items in it, then do the non-items expire with an Autoload:
> > 
> > interchange.cfg:
> > 
> > GlobalSub <<EOR
> > sub expire_check {
> > 	my $now = time;
> > 	# default 1 hour
> > 	my $interval = $::Variable->{EXPIRE_NO_ITEMS} || "1 hour";
> > 	my $expire_secs = Vend::Config::time_to_seconds($interval);
> > 	if($now - $Vend::Session->{time} > $expire_secs) {
> > 		Vend::Session::new_session();
> > 	}
> > 	return;
> > }
> > EOR
> > 
> > catalog.cfg:
> > 
> >     Autoload expire_check
> > 
> > That is untested, but it should work. You are good enough to make it
> > work if for some reason it doesn't. 8-)
> Maybe I am not good enough or at least I did not do a good job stating
> my problem ;-)
> 
> Currently I have an external script periodically deleting old sessions
> from my disk drive. I do this so my disk won't fill up and because I
> understand Interchange does not like to have many extra session files
> laying around. I would like to modify my script to not delete session
> files that contain shopping cart items. My script knows the name of the
> file. How can it know if that file has a shopping cart with items?
> 
> If what you gave me does that it is flying way over my head. Thanks for
> all of your help.

That would require writing an expire script that uses Storable to
eval the session file, and look for the carts there.

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.765.647.1295  tollfree 800-949-1889 <mike at perusion.com>

For a successful technology, reality must take precedence over public
relations, for Nature cannot be fooled. -- Dick Feynman


More information about the interchange-users mailing list