[ic] Expire Sessions Selectively

Bill Carr bill at worldwideimpact.com
Wed Jun 30 10:23:41 EDT 2004


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.

-- 
Bill Carr
Worldwide Impact
bill at worldwideimpact.com
413-253-6700



More information about the interchange-users mailing list