How can we improve CI sessions. When we put it on the live server it only works with setting the path to a specific directory:
sess_save_path = APPPATH . "/someDirectory"
However, this fills the directory with hundreds of sessions files? Let's say we don't want to store them in a database either.
What can we do to overcome this limitation?
The session data does have to be stored somewhere? Where else could it be stored if not in the file directory or the database? You cannot store it in a cookie - are there any other options?
I have no idea, I guess it doesn't take up too much space being a very small file size.
The only other thing I could think of was running a cron job periodically during the night to purge the session folder, but what is night time for anybody in the world. It's different?
I believe CI cleans this out automatically. If you set sess_regenerate_destroy to TRUE, then old session data will be removed when it is regenerated.
I must admit I was suprised by how much session data was generated even in a table, but to be honest, I am not sure I know enough about sessions to worry about it. Just one of those things I have to let CI take care of. Perhaps if I had time I could do some experimenting with it, but the session table never gets too large to worry about. And it does seem to clean itself out because it never seems to be filled with old data.
For instance, on a site I am building at the moment that only myself and one other person has access too during build, the oldest session record is from the 7th Feb, although have been building the site for much longer than that. So the garbage collector must be doing it's job. (There are 46 entries though, which is the bit that confuses me. But not enough to look into it in any detail.)
I have experienced some problems with sess_regenerate_destroy. Don't assume that is your best option.