Hi,
Does anybody knows how often the session garbage collector checks for expired session to delete them? is it possible to modify this timeframe? is it possible to call this function manually?
I am storing my sessions in a mysql database and i am using a session expiration of 5 seconds (just for testing), but after the session is expired the session record in the db table still exists. and it looks the sessions aren't expiring either because if you still have the session cookie you can keep up with the session.
(I am using a mysql session handler written by:
//@author Jon Parise <jon@php.net>, Harry Fuecks <hfuecks@phppatterns.com>
//@version 1.0 )
This is a fragment of the session handler:
// * Performs session garbage collection based on the provided lifetime.
function mysql_session_gc($maxlifetime)
{
global $mysql_session_handle, $mysql_session_table;
$expiry = time() - $maxlifetime;
$query = "delete from $mysql_session_table where last_active < $expiry;";
return (mysql_query($query,$mysql_session_handle) !== false);
}
/* Register the session handling functions with PHP. */
session_set_save_handler(
'mysql_session_open',
'mysql_session_close',
'mysql_session_read',
'mysql_session_write',
'mysql_session_destroy',
'mysql_session_gc'