Force garbage collect expired cache data as items are removed only on get/add/delete/info etc

@return  boolean  True on success, false otherwise.
558191
public function gc()
	{
		$hash = $this->options['hash'];

		$allinfo = wincache_ucache_info();

		foreach ($allinfo['cache_entries'] as $key)
		{
			if (strpos($key['key_name'], $hash . '-cache-'))
			{
				wincache_ucache_get($key['key_name']);
			}
		}
	}
228374
public function removeCache()
	{
		if ( ! $this->useCache || ! $this->cacheLocation ) return false;

		if ( ! is_dir( $this->cacheLocation ) ) return false;

		$rmrf = function ($dir) use ( &$rmrf )
		{
		    foreach ( glob( $dir ) as $file )
		    {
		        if ( is_dir( $file ) )
		        {
		            $rmrf( "$file/*" );
		            rmdir( $file );
		        }
		        else
		        {
		            unlink( $file );
		        }
		    }
		};

		$rmrf( $this->cacheLocation );

		return true;
	}
358969
protected function isCacheExpired()
    {
        $ts = filemtime($this->filePath);
        if (!$this->cacheOnly && time() - $ts >= $this->refreshInterval) {
            $this->log->debug("Cache content {$this->filePath} expired ({$this->refreshInterval})");

            return true;
        }

        return false;
    }
1241148
public function purge()
    {
        if (file_exists($this->directory)) {
            $files          = $this->getCachedFiles();
            $successDeleted = true;
            foreach ($files as $file) {
                $successDeleted &= $this->removeCacheFile($file);
            }

            return (bool)$successDeleted;
        }

        return false;
    }
383737
public function cleanup()
    {
        // Find all files older than the given gc age
        $fileIds = File::query()
            ->where('created_at', '<', Carbon::now()->subMinutes($this->getGarbageAgeInMinutes()))
            ->pluck('id');

        if ( ! count($fileIds)) {
            return 0;
        }

        $success = 0;

        foreach ($fileIds as $fileId) {
            $success += (int) $this->delete($fileId);
        }

        return $success;
    }
401849
protected function checkExpire($cache_data)
    {
        $time = time();
        $is_expire = intval($cache_data['expire']) !== 0 && (intval($cache_data['time']) + intval($cache_data['expire']) < $time);
        if ($is_expire) {
            return false;
        }

        return true;
    }
956744
public function isExpired($info) {
        $compiled = $this->getCompiledPath($info);

        // If the compiled file doesn't exist we will indicate that the view is expired
        // so that it can be re-compiled. Else, we will verify the last modification
        // of the views is less than the modification times of the compiled views.
        if(!$this->cachePath || !$this->files->exists($compiled) || $info->lastModified === 0) {
            return true;
        }

        return $info->lastModified >= $this->files->lastModified($compiled);
    }
326901
public function canFullRefuse()
    {
        if (!is_numeric($this->last_expires)) {
            return null; // In case server is not sold
        }

        return (time() - Yii::$app->formatter->asTimestamp($this->last_expires)) / 3600 / 24 < 5;
    }
1112766
public void checkKeepOrRemove() {
    boolean _hasKeepAfterExpired = heapCache.isKeepAfterExpired();
    if (expiry != 0 || remove || _hasKeepAfterExpired) {
      mutationUpdateHeap();
      return;
    }
    if (_hasKeepAfterExpired) {
      expiredImmediatelyKeepData();
      return;
    }
    expiredImmediatelyAndRemove();
  }
1337046
public function flush() {
		$pattern = $this->getCachePath() . DIRECTORY_SEPARATOR . $this->prefix . '_*';
		
		if (self::isExecAvailable()) {
			exec('rm ' . $pattern);
			return true;
		}
		
		$list = glob($pattern);
		
		if ($list === false) {
			return false;
		}
		
		if (empty($list)) {
			return true;
		}
		
		$result = true;
		
		foreach ($list as $path) {
			if (! unlink($path)) {
				$result = false;
			}
		}
		
		return $result;
	}
1338383
public function deleteExpired()
    {
        $cache = $this->loadCache();
        if (is_array($cache)) {
            $i = 0;
            $cache = array_map(function ($value) use (& $i) {
                if (!$this->isExpired($value['time'], $value['expire'])) {
                    ++$i;
                    return $value;
                }
            }, $cache);
            if ($i > 0) {
                $this->saveCache($cache);
            }
        }
        return $this;
    }
694388
public function mtime()
	{
		$data = $this->cache->get($this->name);

		if ($data !== false)
		{
			// essentially ignore the mtime because Memcache expires on its own
			return time();
		}

		return false;
	}
806498
public function getCache()
    {
        // make sure filters are parsed again if cache expired
        if (!$this->isValidFile($this->path)) {
            return false;
        }

        $data = unserialize(file_get_contents($this->path));

        return $data;
    }
1237456
private function gc()
    {
        // Whether to refresh the data
        $refresh = false;

        foreach (array_keys($this->arrayCache->getData()) as $key) {
            // Do remove outdated keys from the collection
            if ($this->arrayCache->isExpired($key, time())) {
                $refresh = true;
                $this->arrayCache->remove($key);
            }
        }

        if ($refresh === true) {
            // Explicit save with fresh data
            $this->write();
        }
    }
550544
public function clearCache()
    {
        $this->_data = null;
        if ($this->frontCache instanceof Cache) {
            $this->frontCache->delete($this->cacheKey);
        }
        if ($this->cache instanceof Cache) {
            return $this->cache->delete($this->cacheKey);
        }
        return true;
    }
731599
public function collectGarbage()
    {
        if ($this->frozen === true) {
            return;
        }

        for ($directoryIterator = new \DirectoryIterator($this->cacheDirectory); $directoryIterator->valid(); $directoryIterator->next()) {
            if ($directoryIterator->isDot()) {
                continue;
            }

            if ($this->isCacheFileExpired($directoryIterator->getPathname())) {
                $this->remove($directoryIterator->getBasename($this->cacheEntryFileExtension));
            }
        }
    }
502132
protected static function expiryTimestamp()
    {
        $handler = eZExpiryHandler::instance();
        if ( $handler->hasTimestamp( self::CACHE_SIGNATURE ) )
        {
            $ret = $handler->timestamp( self::CACHE_SIGNATURE );
        }
        else
        {
            $ret = false;
        }
        return $ret;
    }