public function collectGarbage()
    {
        if ($this->inactivityTimeout === 0) {
            return 0;
        }
        if ($this->metaDataCache->has('_garbage-collection-running')) {
            return false;
        }

        $sessionRemovalCount = 0;
        $this->metaDataCache->set('_garbage-collection-running', true, [], 120);

        foreach ($this->metaDataCache->getIterator() as $sessionIdentifier => $sessionInfo) {
            if ($sessionIdentifier === '_garbage-collection-running') {
                continue;
            }
            $lastActivitySecondsAgo = $this->now - $sessionInfo['lastActivityTimestamp'];
            if ($lastActivitySecondsAgo > $this->inactivityTimeout) {
                if ($sessionInfo['storageIdentifier'] === null) {
                    $this->logger->warning('SESSION INFO INVALID: ' . $sessionIdentifier, $sessionInfo + LogEnvironment::fromMethodName(__METHOD__));
                } else {
                    $this->storageCache->flushByTag($sessionInfo['storageIdentifier']);
                    $sessionRemovalCount++;
                }
                $this->metaDataCache->remove($sessionIdentifier);
            }
            if ($sessionRemovalCount >= $this->garbageCollectionMaximumPerRun) {
                break;
            }
        }

        $this->metaDataCache->remove('_garbage-collection-running');
        return $sessionRemovalCount;
    }