Cleanup old sessions

@param int $max Max lifetime
486130
public function _gc($max) {
        $old = time() - $max;
        
        ORM::for_table($this->sessions_table)->raw_execute("DELETE * FROM " . $this->sessions_table . " WHERE access < :old", ['old' => $old]);
    }
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);
                }
            }
        }
    }
68795
public function destroy($reason)
    {
        $this->id = null;
        $this->lifetime = 0;
        $this->lastActivityTimestamp = 0;
        $this->maximumAge = -1;
    }
488153
public function flushExpiredCookies()
    {
        foreach ($this->cookieJar as $domain => $pathCookies) {
            foreach ($pathCookies as $path => $namedCookies) {
                foreach ($namedCookies as $name => $cookie) {
                    if ($cookie->isExpired()) {
                        unset($this->cookieJar[$domain][$path][$name]);
                    }
                }
            }
        }
    }
737194
public function deleteOldLogs(int $max_age_in_seconds): void
    {
        $timestamp = Carbon::now()->subSeconds($max_age_in_seconds);

        DB::table('log')
            ->whereIn('log_type', ['error', 'media'])
            ->where('log_time', '<', $timestamp)
            ->delete();
    }
51113
def purge_old(self):
        '''
        
        '''
        if self.keep_max is not None:
            keys = self.redis_conn.keys(self.get_key() + ':*')
            keys.sort(reverse=True)
            while len(keys) > self.keep_max:
                key = keys.pop()
                self.redis_conn.delete(key)
153684
public function clean($expiration)
    {
        $sth = $this->pdo->prepare(
            "DELETE FROM sessions WHERE last_activity < :expiration"
        );

        $sth->bindValue(':expiration', $expiration);
        $sth->execute();
    }
1077046
protected function cleanup()
    {
        $this->_stmt->closeCursor();

        $this->_stmt          = null;
        $this->_rsm           = null;
        $this->_cache         = array();
        $this->_metadataCache = array();
    }
664575
public function gc($maxLifeTime)
    {
        $files = new \FilesystemIterator($this->savePath);
        $maxTime = time() - $maxLifeTime;
        foreach($files as $file)
        {
            $fileName = $file->getPathname();
            if(filemtime($fileName) <= $maxTime)
            {
                unlink($fileName);
            }
        }
    }
247673
protected void cleanOutOldAvatars(File directory, int maxLifeInDays){
        if (directory != null){
            if (mCleanedDirectories.contains(directory.getAbsolutePath())){
                return;
            }
            long oldestTimeAllowed = System.currentTimeMillis() - maxLifeInDays * TimeUnit.DAYS.toMillis(maxLifeInDays);
            File[] files = directory.listFiles();
            if (files != null){
                for (File file : files){
                    if (file.getName().startsWith(DEFAULT_AVATAR_FILE_PREFIX) && file.lastModified() < oldestTimeAllowed){
                        file.delete();
                    }
                }
            }
        }
    }
281924
public function gc($maxlifetime)
    {
        $sessions = \Doctrine::getTable($this->_tableName)->findAll();
        foreach ($sessions as $session) {
            if ($this->_getExpirationTime($session) < time()) {
                $session->delete();
            }
        }

        return true;
    }
817254
public function collectGarbage($maxLifetime = null)
    {
        $maxLifetime = $maxLifetime ?: ini_get('session.gc_maxlifetime');
        $this->sessionRegistryStorage->collectGarbage($maxLifetime);
    }
891264
public function gc($max)
    {
        // delete sessions older than max TTL
        $ttl = time() - $max;

        return $this->app['db']
            ->delete(self::TABLENAME)
            ->where('access', $ttl, '<')
            ->execute() instanceof PDOStatement;
    }
1102865
public function cleanup(DateTimeInterface $maxAge): void
    {
        $queryBuilder = $this->entityManager->createQueryBuilder();
        $queryBuilder->delete(CachedSearchResult::class, 'r')
                     ->andWhere('r.lastSearchTime < :maxAge')
                     ->setParameter('maxAge', $maxAge);

        $queryBuilder->getQuery()->execute();
    }
940941
public void setMaxActiveSessions( final int max ) {
        final int oldMaxActiveSessions = _maxActiveSessions;
        _maxActiveSessions = max;
        support.firePropertyChange( "maxActiveSessions",
                Integer.valueOf( oldMaxActiveSessions ),
                Integer.valueOf( _maxActiveSessions ) );
    }
759257
public function gc($sessMaxLifeTime) { 
       $hander = 	is_array($this->hander)?$this->hander[0]:$this->hander;
       mysql_query('DELETE FROM '.$this->sessionTable.' WHERE session_expire < '.time(),$hander); 
       return mysql_affected_rows($hander); 
   }
131382
public function gc($maxlifetime): bool
    {
        DB::table('session')
            ->where('session_time', '<', Carbon::now()->subSeconds($maxlifetime))
            ->delete();

        return true;
    }