[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ic] MySql sessions - expiring


Jon Jensen wrote:
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

Thanks Jon,

I'll have to look into that. I did notice that there is a timestamp field in the table, probably for just this use. I'll look at trying to add this to the cronjobs.

Thanks,
dorothy

_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.