Exemplo n.º 1
0
 /**
  * Store the session payload in storage.
  * This method will be called automatically at the end of the request.
  *
  * @return void
  */
 public function save()
 {
     $this->session['last_activity'] = time();
     // age it that should expire at the end of the user's next request.
     $this->age();
     $sessionConf = Config::get('session');
     // save data into the specialized storage.
     $this->storage->save($this->session, $sessionConf, $this->exists);
     // determine the owner of the session
     // on the user's subsequent requests to the application.
     $this->cookie($sessionConf);
     // calculate and run garbage collection cleaning.
     $cleaning = $sessionConf['garbage_collection'];
     if (mt_rand(1, $cleaning[1]) <= $cleaning[0]) {
         $this->clean();
     }
 }