in reply to Re: sessions
in thread Age of CGI sessions?

Sorry I didn't include enough detail in my first post. I'm using CGI::Session and I have my sessions expire set at 30 minutes:

$session->expire('+30m')

My problem is that my MySQL database keeps filling up with sessions that I want to delete after they are expired. I was thinking about parsing the epoc out of the a_session field, but I am looking for a more elegant way to clean the expired sessions out of the database.

Thanks

Replies are listed 'Best First'.
Re: Re:Re: Age of CGI sessions?
by The Mad Hatter (Priest) on Jun 05, 2003 at 23:43 UTC
    I see. I haven't used CGI::Session before, but perhaps you could use a combination of $session->atime, $session->expire, localtime, and $session->delete to get something like this pseudo-code:
    $session->delete if (($session->atime + $session->expire) < localtime) +;