[ic] Expire Sessions Selectively

New Media E.M.S. ic_users at newmediaems.com
Wed Jun 30 11:38:43 EDT 2004


At 07:23 AM 6/30/2004, you wrote:

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

Well, without knowing much about how your script is written and what it 
is/isn't capable of doing with regards to the contents of a session file, 
who's to say. I can tell you that one of the stored session values is 
latest_subtotal, and if this is present and is > 0, then the customer most 
likely has items in the cart. Perhaps your script (if it is written in 
Perl) can use Dumper to read in and evaluate each session hash, or even 
just do some kind of regex on the contents of the file, but this will 
almost certainly increase disk activity dramatically.

- Ed


===============================================================
New Media E.M.S.              Technology Solutions for Business
11630 Fair Oaks Blvd., #250   eCommerce | Consulting | Hosting
Fair Oaks, CA  95628          edl at newmediaems.com
(916) 961-0446                http://www.newmediaems.com
(866) 519-4680 Toll-Free      (916) 961-0447 Fax
=============================================================== 



More information about the interchange-users mailing list