Re: Sessions - Informed Opinions
| From: | Danny Shepherd | Date: | Tue, 30 Jul 2002 11:02:32 +0000 |
| Subject: | Re: Sessions - Informed Opinions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-110339@lists.php.net to get a copy of this message | ||
----- Original Message -----
From: "Rasmus Lerdorf" <rasmus@php.net>
To: "Danny Shepherd" <danny@kyboshed.com>
Cc: "PHP-General" <php-general@lists.php.net>
Sent: Tuesday, July 30, 2002 11:52 AM
Subject: Re: [PHP] Sessions - Informed Opinions
> > > > 3 How can I get a count of currently active (I.e non expired)
> > sessions?
> > >
> > > Count the number of session files.
> > Can I be sure that the count will only include active sessions though?
>
> By definition, if the session file is there, it is an active session.
> There is no such thing as counting active users on the Web. You define a
> time window and count how many users accessed your site within that
> window. Once a session has been idle for a time > than the configured
> session gc time, it will get deleted. I tend to do this out of band
> though. PHP has a mechanism for calling the session gc code, but I prefer
> to turn this off and run my own cron job that does this regularly. And
> yes, this is easier to manage if you have a database where you can do a
> simple count() query to get the number of active sessions.
Right, db sessions seem to be the way for me, thanks Rasmus. (Oh, thanks for
PHP too :)
Danny.