In some rare cases the cache file will not contain the class
name we expect. When this happens, destroy the corrupt file,
flush the request cache, and repeat the cycle.
@return void
348017
protected function handleCorruptCache($data)
    {
        $path = array_get($data, 'filePath', $this->getCacheFilePath());

        if (is_file($path)) {
            if (($className = $this->extractClassFromFile($path)) && class_exists($className)) {
                $data['className'] = $className;
                return $data;
            }

            @unlink($path);
        }

        unset(self::$cache[$this->filePath]);

        return $this->parse();
    }
1070889
public function flush()
    {
        if (false === (bool)$this->configuration->get('clearCacheForAllDomains')) {
            $this->flushByTag('sfc_domain_' . \str_replace('.', '_', GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY')));

            return;
        }

        $this->logger->debug('SFC Flush');

        if ($this->isBoostMode()) {
            $identifiers = GeneralUtility::makeInstance(CacheRepository::class)->findAllIdentifiers();
            $this->getQueue()->addIdentifiers($identifiers);

            return;
        }

        $absoluteCacheDir = GeneralUtility::getFileAbsFileName(self::CACHE_DIRECTORY);
        $removeService = GeneralUtility::makeInstance(RemoveService::class);
        $removeService->softRemoveDir($absoluteCacheDir . 'https/');
        $removeService->softRemoveDir($absoluteCacheDir . 'http/');
        parent::flush();
        $removeService->removeDirs();
    }
888398
private function clearCache(): void
    {
        try {
            $cacheTag = config('netcore.module-category.cache_tag');
            $isRedis = cache()->getStore() instanceof RedisStore;

            if ($cacheTag && $isRedis) {
                cache()->tags([$cacheTag])->flush();
            } else {
                cache()->flush();
            }
        } catch (Exception $exception) {
            logger()->error('[module-category] Unable to clear cache: ' . $exception->getMessage());
        }
    }
69102
public function flush()
        {
            if (!$this->enabled) return;

            switch ($this->type) {
                case self::TYPE_FILE:
                    $iterator = new \DirectoryIterator($this->path);
                    foreach ($iterator as $file_info)
                    {
                        if (!$file_info->isDir())
                        {
                            unlink($file_info->getPathname());
                        }
                    }
            }
        }
129346
public function flushFacades()
    {
        if (! $this->files->exists($storagePath = storage_path('framework/cache'))) {
            return;
        }

        foreach ($this->files->files($storagePath) as $file) {
            if (preg_match('/facade-.*\.php$/', $file)) {
                $this->files->delete($file);
            }
        }
    }
558678
public function clear()
    {
        $result = true;

        foreach (glob("{$this->path}/*.cache") as $filename) {
            if (!unlink($filename)) {
                $result = false;
            }
        }

        return $result;
    }
1159621
public static function flush()
    {
        // Ensure that this instance is constructed on flush, thus forcing
        // bootstrapping of necessary .htaccess / web.config files
        $instance = singleton(AssetStore::class);
        if ($instance instanceof FlysystemAssetStore) {
            $public = $instance->getPublicFilesystem();
            if ($public instanceof Filesystem) {
                $publicAdapter = $public->getAdapter();
                if ($publicAdapter instanceof AssetAdapter) {
                    $publicAdapter->flush();
                }
            }
            $protected = $instance->getProtectedFilesystem();
            if ($protected instanceof Filesystem) {
                $protectedAdapter = $protected->getAdapter();
                if ($protectedAdapter instanceof AssetAdapter) {
                    $protectedAdapter->flush();
                }
            }
        }
    }
741255
public function flush()
    {
        if (($files = $this->getCacheFiles()) === false) {
            return false;
        }

        $result = true;
        foreach ($files as $file) {
            $result = $result && @unlink($file);
        }
        return $result;
    }
1362451
public function flushCache()
    {
        $database = $this->getDatabase();
        
        $tables = static::getTables($database);
        
        $key  = 'db/tables/' . $database;
        static::getCache()->remove($key);
        
        if ($tables) {
            foreach ($tables as $table) {
                $key  = 'db/tableinfo/' . $table;
                static::getCache()->remove($key);
            }
        }
    }
729067
function resetCache()
    {
        if ( $this->CacheFile && file_exists( $this->CacheFile ) )
            unlink( $this->CacheFile );
        if ( $this->PlacementCacheFile && file_exists( $this->PlacementCacheFile ) )
            unlink( $this->PlacementCacheFile );
    }
975406
public static function purgeCache()
	{
		$filePaths = static::getCacheFilePaths();

		if (file_exists($filePaths['fullPath'])) {
			$file = new \File($filePaths['path'], true);
			$file->write('');
			$file->close();
			static::refreshOpcodeCache($filePaths['fullPath']);
		}
	}
525901
protected function setCache()
    {
        if ($this->cache) {
            $cacheFile = $this->getCacheFile();
            file_put_contents($cacheFile, $this->templateOutput);
        }
    }
1012316
public function clean()
    {
        try {
            $result = [
                'result'        => isset($this->cacheInstance) && is_object($this->cacheInstance) ? $this->cacheInstance->clear() : FALSE,
                'commit'        => isset($this->cacheInstance) && is_object($this->cacheInstance) ? $this->cacheInstance->commit() : NULL,
                'getDriverName' => isset($this->cacheInstance) && is_object($this->cacheInstance) ? $this->cacheInstance->getDriverName() : NULL,
                'getStats'      => isset($this->cacheInstance) && is_object($this->cacheInstance) ? $this->cacheInstance->getStats() : NULL,
                'getConfig'     => isset($this->cacheInstance) && is_object($this->cacheInstance) ? $this->cacheInstance->getConfig() : NULL,
            ];
            $this->debug->debug(__FUNCTION__, 'Clear Cache from Handler: ' . json_encode($this->cacheHandle) . ' -> Result: ' . json_encode($result));

            return $result;
        }
        catch (\Exception $e) {
            $message = 'Error File: ' . $e->getFile() . ' - Line: ' . $e->getLine() . ' - Code: ' . $e->getCode() . ' - Message: ' . $e->getMessage();
            $this->debug->error(__FUNCTION__, $message);

            return $message;
        }
    }
179694
public function clean()
    {
        if (!($files = $this->getCacheFiles())) {
            return false;
        }

        foreach ($files as $file) {
            $key = basename($file, $this->extension);
            $this->get($key); // Automatically deletes if expired
        }
        return true;
    }
65025
public function clearCache() {
        $files = glob($this->getConfig('cacheDir') . '/*', GLOB_MARK);
        foreach ($files as $file) {
            unlink($file);
        }
    }
867497
protected function clearCache()
    {
        $oldCacheDirName = "{$this->cacheDir}_old";
        $this->fs->rename($this->cacheDir, $oldCacheDirName);
        $this->fs->remove($oldCacheDirName);
    }
721621
public function purgeAll() {
		if ($this->log) {
			if ($this->log instanceof LoggerInterface) {
				$this->log->info("Purging the whole file cache.");
			} else {
				$this->log->trace("Purging the whole file cache.");
			}
		}
		$files = glob($this->getDirectory()."*");
        if (false !== $files){// some file systems wont distinguish between empty match and an error
            $prefixFile = str_replace(array("_", "/", "\\", ":"), array("___", "_s_", "_b_", "_d_"), $this->prefix);
            foreach ($files as $filename) {
                if (empty($prefixFile) || strpos(basename($filename), $prefixFile) === 0) {
                    unlink($filename);
                }
            }
        }
	}