[ic] Expire Sessions Selectively

Mike Heins mike at perusion.com
Mon Jun 28 16:00:27 EDT 2004


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-)

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

"Laughter is inner jogging." -- Norman Cousins


More information about the interchange-users mailing list