Delete all expired sessions from persistent storage.

@param int $expiration

@return mixed|void
434717
public function clean($expiration)
    {
        $files = glob($this->path . '*');

        if ($files === false) {
            return;
        }

        foreach ($files as $file) {
            if (filetype($file) == 'file' && filemtime($file) < $expiration) {
                unlink($file);
            }
        }
    }
702817
public function expired($onSessionExpires = false)
    {
        if (!$this->_data['expires'] && $onSessionExpires) {
            return true;
        }

        return $this->_data['expires'] < time() && $this->_data['expires'];
    }
469685
protected function expiration($key)
	{
		$lifetime = ini_get("session.gc_maxlifetime");

		$expire = $this->engine->get($key . '_expire');

		// Set prune period
		if ($expire + $lifetime < time())
		{
			$this->engine->delete($key);
			$this->engine->delete($key . '_expire');
		}
		else
		{
			$this->engine->replace($key . '_expire', time());
		}
	}
427901
public function cleanup($expire) {
        if ($dir = opendir($this->dir)) {
            while (false !== ($file = readdir($dir))) {
                if(!is_dir($file) && $file != '.' && $file != '..') {
                    $lasttime = @filemtime($this->dir.$file);
                    if (time() - $lasttime > $expire) {
                        @unlink($this->dir.$file);
                    }
                }
            }
            closedir($dir);
        }
    }
400386
public function set($key, $value, $expire = 0)
    {
        if ($this->expire) {
            $expire = $this->expire;
        }

        return $this->handle->set($key, $value, $expire);
    }
20307
public function store($key, $value, $expiration = 0)
    {
        // $this->getTimeout(); Do delete based on the session time out
        $data = [
            'time'   => time(),
            'expire' => $expiration,
            'data'   => $value,
        ];

        if ($this->where == true) {
            $this->setCache($key)
                 ->setPath(CYGNITE_BASE.DS.toPath('public.storage.cache').DS);
        }

        if (is_array($this->getCache())) {
            $array = $this->getCache();
            $array[$key] = $data;
        } else {
            $array = [$key => $data];
        }

        $cacheData = json_encode($array);

        if ($this->getDirectory() == true) {
            @file_put_contents($this->getDirectory(), $cacheData);
        }

        return $this;
    }
141247
private function setExpiration($expires_in)
    {
        $this->expiresAtTimestamp = time() + $expires_in;
        $this->expiresAt = date('Y-m-d H:i:s', time() + $expires_in);
    }
483490
private function purgeOrphanedInUseSessions(array &$data)
    {
        foreach ($data['inUse'] as $key => $session) {
            if ($session['lastActive'] + SessionPoolInterface::SESSION_EXPIRATION_SECONDS < $this->time()) {
                unset($data['inUse'][$key]);
            } elseif ($session['lastActive'] + self::DURATION_TWENTY_MINUTES < $this->time()) {
                unset($session['lastActive']);
                array_push($data['queue'], $session);
                unset($data['inUse'][$key]);
            }
        }
    }
1347846
protected function store_check_expiration($expiration=null) {
		if (!$expiration)
			return 3600 * 2;
		$expiration = (int)$expiration;
		if ($expiration < 600)
			$expiration = 600;
		return $expiration;
	}
1326407
public function deleteExpired()
    {
        if ($this->isExpirationEnabled()) {
            $expiredAt = Carbon::now()->subSeconds($this->expires);

            $this->getTable()->where('created_at', '<', $expiredAt)->delete();
        }
    }
1028846
private function cleanup()
    {
        if (isset($this->collection[$this->id_info])) {
            foreach ($this->collection[$this->id_info] as $key => $val) {
                $expire = $this->getSessionInfo($key, 'expire');
                if ($expire === true) {
                    $this->setSessionInfo($key, 'expire', -1);
                } elseif ($expire == -1) {
                    $this->delete($key);
                }
            }
        }
    }
1370968
public function ___expire($id)
    {
        $this->_fastBackend->remove($id);
        $this->_slowBackend->___expire($id);
    }
491635
public function deleteExpired()
    {
        $expiredAt = Carbon::now()->subSeconds($this->expires);

        $this->getTable()
             ->delete($this->table)
             ->where('created_at < :expiredAt')
             ->setParameter('expiredAt', $expiredAt)
             ->execute();
    }
1215778
public static function set(string $key, $value, int $expire = null): bool
    {
        return self::storage()->set($key, $value, $expire);
    }
965629
public function setExpire(\DateTime $expire = null)
    {
        $this->_expire = ($expire) ? $expire : null;

        return $this;
    }
1074725
public final function expiresAt($expiration)
   {
       $this->timeToLive = $expiration instanceof DateTime
                         ? $expiration->getTimestamp() - time()
                         : (int) $expiration;
       return $this;
   }
575047
private function cleanExpired()
    {
        // 10% chance to clean the database of expired sessions
        if (mt_rand(1, 10) == 1) {
            $expiredTime = $this->now - $this->secondsUntilExpiration;
            $stmt = $this->db->prepare("DELETE FROM {$this->tableName} WHERE time_updated < {$expiredTime}");
            $stmt->execute();
        }
    }