We will refill the cache dir by emptying it and filling it again

@return bool
492575
protected function refillCache()
    {

        // lets clear the cache so we can fill it anew
        foreach (new \DirectoryIterator($this->getConfig()->getValue('cache/dir')) as $fileInfo) {
            if (!$fileInfo->isDot() && !$fileInfo->isDir()) {
                // unlink the file
                unlink($fileInfo->getPathname());
            }
        }

        // lets create the definitions anew
        return $this->createDefinitions();
    }
915392
public function mustRefresh()
    {
        if ($this->fileExists()) {
            $this->_cleanFilesStack();
            $_dest = new \SplFileInfo($this->getDestinationRealPath());
            if (!empty($this->files_stack)) {
                foreach ($this->files_stack as $_file) {
                    if ($_file->getMTime() > $_dest->getMTime()) {
                        return true;
                    }
                }
                return false;
            }
        }
        return true;
    }
1358991
protected function doFlush()
    {
        // Clear Doctrine's folder.
        $result = parent::doFlush();

        if ($this->filesystem instanceof CompositeFilesystemInterface) {
            $cacheFs = $this->filesystem->getFilesystem('cache');
            // Clear our cached configuration
            if ($cacheFs->has('config-cache.json')) {
                $cacheFs->delete('config-cache.json');
            }

            // Clear our own cache folder.
            $this->flushDirectory($cacheFs->getDir('/development'));
            $this->flushDirectory($cacheFs->getDir('/exception'));
            $this->flushDirectory($cacheFs->getDir('/production'));
            $this->flushDirectory($cacheFs->getDir('/profiler'));
            $this->flushDirectory($cacheFs->getDir('/trans'));

            // Clear the thumbs folder.
            $this->flushDirectory($this->filesystem->getFilesystem('web')->getDir('/thumbs'));

            // We need to recreate our base Doctrine cache directory, as it
            // will be a subdirectory of one of the ones we just wiped.
            $this->createPathIfNeeded();
        }

        return $result;
    }
196340
public function clear()
	{
		// Path to cache folder
		$cacheDir = PATH_APP . DS . 'cache' . DS . '*';

		// Remove recursively
		foreach (glob($cacheDir) as $cacheFileOrDir)
		{
			$readable = str_replace(PATH_APP . DS, '', $cacheFileOrDir);
			if (is_dir($cacheFileOrDir))
			{
				if (!Filesystem::deleteDirectory($cacheFileOrDir))
				{
					$this->output->addLine('Unable to delete cache directory: ' . $readable, 'error');
				}
				else
				{
					$this->output->addLine($readable . ' deleted', 'success');
				}
			}
			else
			{
				// Don't delete index.html
				if ($cacheFileOrDir != PATH_APP . DS . 'cache' . DS . 'index.html')
				{
					if (!Filesystem::delete($cacheFileOrDir))
					{
						$this->output->addLine('Unable to delete cache file: ' . $readable, 'error');
					}
					else
					{
						$this->output->addLine($readable . ' deleted', 'success');
					}
				}
			}
		}

		$this->output->addLine('Clear cache complete', 'success');
	}
157973
public static function clearAll()
    {
        $dir = new \DirectoryIterator(static::config('directory'));

        foreach ($dir as $fileinfo) {

            if ($fileinfo->isFile()) {
                $cacheKey = $fileinfo->getFilename();
                static::clear($cacheKey);
            }
        }
    }
1143620
public function refreshDir($dir)
    {
        $dirs = is_array($dir) ? $dir : func_get_args();

        return $this->request($dirs, 'dirs', 'RefreshCdnDir');
    }
741255
public function flush()
    {
        if (($files = $this->getCacheFiles()) === false) {
            return false;
        }

        $result = true;
        foreach ($files as $file) {
            $result = $result && @unlink($file);
        }
        return $result;
    }
544093
public function flush()
    {
        if (empty($this->memcache)) {
            return false;
        }

        $flushStatus = $this->memcache->flush();

        return $flushStatus;
    }
103173
protected function cachedFile()
    {
        if (null === $this->cachedFile) {
            $this->cachedFile = rtrim($this->dir, '/') . '/' . ltrim($this->filename, '/');
        }

        return $this->cachedFile;
    }
633812
public function flushCache()
    {
        $finder = new Finder();

        foreach ($finder->files()->in($this->cacheDir)->name('*.php') as $file) {
            unlink($file->getRealpath());
        }

        return true;
    }
1000051
public function flush($dir = '')
    {
        $dir = $cache_dir = APP_PATH . '/' . Config::get('cache_dir');
        \ePHP\Misc\Dir::deleteDir($dir);
        mkdir($dir, 0777);
    }
1305714
public function clear()
    {
        foreach ($this->filesystem()->listContents() as $file) {
            $this->filesystem()->delete($file['path']);
        }

        return true;
    }
548750
public function dir_rewinddir()
    {
        if ($this->dirHandle === null) {
            return false;
        }
        self::restore();
        rewinddir($this->dirHandle);
        self::register();
        return true;
    }
984211
public function clear()
    {
        $result = false;
        if (false !== $files = @scandir($this->cachedir)) {
            foreach ($files as $file) {
                $file = $this->cachedir.DIRECTORY_SEPARATOR.$file;
                if (false === is_dir($file)) {
                    if (false === @unlink($file)) {
                        $this->log('warning', sprintf('Enable to remove cache file `%s`.', $file));
                    } else {
                        $result = true;
                    }
                }
            }
        }

        if (true === $result) {
            $this->log('debug', sprintf('File system cache cleared in `%s`.', $this->cachedir));
        }

        return $result;
    }
746740
public function getCacheDir()
    {
        static $dir;
        if (empty($dir)) {
            $dir = $this->getOpenDir() . '/cache/';

            if (!is_dir($dir)) {
                mkdir($dir, 0755, true);
            }
        }
        return $dir;
    }
319052
public function useCache()
    {
        if (is_callable($this->get_cache_callback)
            && is_callable($this->set_cache_callback)
            && is_callable($this->delete_cache_callback)) {
            return true;
        }

        return false;
    }
196819
public function clearCache()
    {
        $result = $this->getContainer()->get('fileManager')->removeInDir($this->cachePath);

        if ($result != true) {
            throw new Exceptions\Error("Error while clearing cache");
        }

        $this->updateCacheTimestamp();

        return $result;
    }