CodeIgniter Forums
CI Sessions on database - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: CI Sessions on database (/showthread.php?tid=43863)



CI Sessions on database - El Forum - 07-26-2011

[eluser]xerosis[/eluser]
I am storing sessions on my database using CI.

The issue is that it seems CI does not delete them ever, and now this table is becoming enormous. Is there anyway it can actually delete sessions which have been inactive for quite some time or somehow clean up the table?

I am sure many of the sessions are quite old an irrelevant.

Thanks.


CI Sessions on database - El Forum - 07-26-2011

[eluser]cpass78[/eluser]
Ive been having the same trouble since day one and have pretty much chalked it up to "Cant be bothered with finding a fix for it right now" Confused Whats funny is im the only one using the site at the moment and even though trying to get the site from sources other than me produces the forbidden page, its still logging sessions.

Ive en set my $config['sess_time_to_update'] = 10; but still there are empty sessions in the db..


CI Sessions on database - El Forum - 07-26-2011

[eluser]xerosis[/eluser]
A quick fix is to make a cron job which just deletes all the ones which are older than a given timestamp, daily.


CI Sessions on database - El Forum - 07-26-2011

[eluser]cpass78[/eluser]
Yes that has been toyed around with but honestly its just another process that shouldnt need to be running. garbage collection should work as intended should it not.


CI Sessions on database - El Forum - 07-26-2011

[eluser]xerosis[/eluser]
Yes I know. That is actually why I posted this thread hoping it does not reach the point where I need to actually write that cron job! I am sure there is a proper answer to this question.