yii\web\DbSession::gcSession PHP Method

gcSession() public method

Do not call this method directly.
public gcSession ( integer $maxLifetime ) : boolean
$maxLifetime integer the number of seconds after which data will be seen as 'garbage' and cleaned up.
return boolean whether session is GCed successfully
    public function gcSession($maxLifetime)
    {
        $this->db->createCommand()->delete($this->sessionTable, '[[expire]]<:expire', [':expire' => time()])->execute();
        return true;
    }

Usage Example

Example #1
0
 /**
  * Session GC (garbage collection) handler.
  * Do not call this method directly.
  * @param integer $maxLifetime the number of seconds after which data will be seen as 'garbage' and cleaned up.
  * @return boolean whether session is GCed successfully
  */
 public function gcSession($maxLifetime)
 {
     if ($this->dbSession) {
         return $this->dbSession->gcSession($maxLifetime);
     } else {
         parent::gcSession($maxLifetime);
     }
 }
All Usage Examples Of yii\web\DbSession::gcSession