On 15 Sep 2008, at 17:14, Thodoris wrote:
Thanks I have already started working on that. I suppose that I
should run the garbage collector every now and then to see if the
session has expired. I guess this is the basic difference between
the normal sessions and database oriented. The fact that you need
to create a way to check the sessions that are expiring.
Not at all. The garbage collector is run by the session extension
according to rules set out in php.ini. It does it for you. Doesn't
matter whether it's OO or not.
-Stut
You're right I've noticed that every time you run session_start or
it's done automatically (if you set session.auto_start) then gc is
also running. In case you have defined a custom function using
session_set_save_handler then it runs this function instead of the
built-in that cleans the database of the unneeded expired sessions.
Do I get this right or there is something that I am missing?
Not quite. The rules around when the garbage collector is run are not
that simple, but in most cases you don't need to worry about it.
Implement the handler and you can rest assured that it will be called
as often as the default session GC would be called. You can
optionally take the lifetime parameter it gets passed into account
but I personally don't.
-Stut
--
http://stut.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php