[ic] MySql sessions - expiring

Dan Browning db at kavod.com
Sat Sep 27 00:40:55 EDT 2003


* Jon Jensen <jon at endpoint.com> [2003-09-25 15:34]:
> On Thu, 25 Sep 2003, Dorothy Puma wrote:
> 
> > I have recently followed Dan Browning's instructions 
> > (http://www.icdevgroup.org/~danb/ic_howto_cluster.html) for converting 
> > over to MySql based sessions.  It works like a charm.  I checked the 
> > archives and found a posting from Mike Heins 
> > (http://developer2.akopia.com/archive/interchange-users/2000/msg03202.html) 
> > stating that he didn't know if the "expire" would work with this kind of 
> > setup, but I didn't see any follow-ups to that.  Does anyone know how to 
> > expire the sessions if running in mysql mode?
> 
> Hmm ... I think the easiest way would be to add a column to the sessions
> table of type TIMESTAMP, name "last_modified" or similar. In MySQL that 
> would get updated to the current time every time the row's modified, then 
> your session expiration would simply consist of somthing like:
> 
> DELETE FROM sessions
> WHERE CURRENT_TIMESTAMP - last_modified > INTERVAL 4 hours;
> 
> That's untested -- the exact syntax will depend on your version of MySQL.

Jon's right.  That is what I did for expiration (although the syntax doesn't 
come to mind, either).
-- 
Dan Browning, Kavod Technologies, <db at kavod.com> 360.843.4074x217
6700 NE 162nd Ave, Ste 611-210, Vancouver, WA.    Random Fortune:
Lizzie Borden took an axe,
And plunged it deep into the VAX;
Don't you envy people who
Do all the things ___YOU want to do?


More information about the interchange-users mailing list