Phalcon\Session\Adapter\Mongo::gc PHP Method

gc() public method

public gc ( string $maxLifetime )
$maxLifetime string
    public function gc($maxLifetime)
    {
        $minAge = new \DateTime();
        $minAge->sub(new \DateInterval('PT' . $maxLifetime . 'S'));
        $minAgeMongo = new \MongoDate($minAge->getTimestamp());
        $query = ['modified' => ['$lte' => $minAgeMongo]];
        $remove = $this->getCollection()->remove($query);
        return (bool) $remove['ok'];
    }