On Wed, May 3, 2006 11:29 pm, Tony Aldrich wrote:
> Well, I mean visitors of site. They can open it in several windows or
> in
> several browsers. I understand that each browser on a machine will be
> a
> session (in simple explanation). And for all of them I create some
> info in
> database. Then they close browser. I must clean up unused info.
> That's why I want to query alive sessions. Or query their death time
> (timeout).
> I thought of something like
>
> $sess=get_session_list();
>
> or
>
> $isalive=is_session_alive($session_id);

Honestly, the easiest way to solve this is to switch to 'user' PHP
sessions:
http://php.net/session-set-save-handler

Once you do that, you're already nuking the actual session data for
expired sessions in your database, and you can delete anything else in
parallel.

Your only other option would be to troll through /tmp looking for PHP
session filenames that match the session ID or whatever, and then
searching your database for IDs that aren't listed in there, and...

You'd probably end up with a race condition sooner or later, and this
would be dog-slow if you have lots of visitors, and you really don't
want to do it this way.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to