Fw: [PHP-DEV] Session management module - thoughts
| From: | David Fallon | Date: | Sat, 29 May 1999 01:04:59 +0000 |
| Subject: | Fw: [PHP-DEV] Session management module - thoughts | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-6229@lists.php.net to get a copy of this message | ||
> > I'm not sure how to handle cleanup of old sessions. Unfortunately,
> > that seems like it would require something that is definitely not
> > idiot-proof (requiring people to stick a cron job in their crontab),
> > or something ugly (have PHP do a sweep of the session data storage
> > every time session data is accessed).
> >
> > Anyone know how ASP deals with it?
>
> While I don't know how ASP deals with it, I can think of a vague approach
> towards a solution. We can probably spawn a thread (under Win32) or a
> process (under UNIX) that'll simply clean up old sessions, while sleeping
> most of the time. We can kill this thread/process at the server shutdown.
ASP has a session_timeout variable, then has a thread sweep through the
memory every x minutes, checking for sessions that have been around longer
than session_timeout, and deletes them. Very straightforward. Best way to do
it. Depending on how clever you get, you probably want to have two
functions, one to clear all sessions, and the other to clear timed-out
sessions (and then have a flag that says "do I (the user) handle session
cleanup, or does php?), so you can do things like say "sessions time out in
20 minutes, but I don't want to clear them until i run this cron job at
3am."
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net