Welcome Guest, Not a member yet? Register   Sign In
ci_sessions table is getting big - like 6M records and 90meg big
#2

Maybe a cron like this would help:

PHP Code:
/**
 * Garbage collection on the ci_sessions table.
 *
 * crontab entry for once a day at 12:59am (59 3 * * *):
 * /usr/local/bin/php /path/to/index.php crons ci_sessions_gc > /dev/null 2>&1
 */
public function ci_sessions_gc()
{
 
   $this->load->database();
 
   $this->config->load('db_tables');
 
   
    $sess_expiration 
config_item('sess_expiration');
 
   $sess_save_path  config_item('sess_save_path');

 
   if$sess_expiration )
 
   {
 
       $epoch_expired time() - $sess_expiration;
 
       $this->db->where('timestamp <'$epoch_expired)
 
           ->delete$sess_save_path );
 
   }
}

// ----------------------------------------------------------------------- 
Reply


Messages In This Thread
RE: ci_sessions table is getting big - like 6M records and 90meg big - by skunkbad - 07-02-2018, 05:26 PM



Theme © iAndrew 2016 - Forum software by © MyBB