The Session class built-in garbage collection isn't working |
[eluser]emurad[/eluser]
Hello, The Session class built-in garbage collection isn't deleting any of the previous database sessions. I'm depending on the session table to get the total of online users so that's a problem for me. When I close the browser and open it again a new record is added to the sessions table, nothing is deleted. Code: $config['sess_cookie_name'] = 'somename_session'; Please help.
[eluser]Drew J[/eluser]
Garbage collection happens periodically... not the instant your browser creates a new session. Take a look at the _sess_gc() function in the Session.php file; it uses the rand() function and the $gc_probability variable to randomly/periodically clear out expired sessions. If it checked for and deleted expired sessions on every page load, it would be really taxing on the database. Quick link to view the function/class. |
Welcome Guest, Not a member yet? Register Sign In |