Flushes caches as needed if settings, routes or policies have changed

@param array $changedFiles A list of full paths to changed files
@return void
@see flushSystemCachesByChangedFiles()
506680
protected function flushConfigurationCachesByChangedFiles(array $changedFiles): void
    {
        $aopProxyClassRebuildIsNeeded = false;
        $aopProxyClassInfluencers = '/(?:Policy|Objects|Settings)(?:\..*)*\.yaml/';

        $objectClassesCache = $this->getCache('Flow_Object_Classes');
        $objectConfigurationCache = $this->getCache('Flow_Object_Configuration');
        $caches = [
            '/Policy\.yaml/' => ['Flow_Security_Authorization_Privilege_Method', 'Flow_Persistence_Doctrine', 'Flow_Persistence_Doctrine_Results', 'Flow_Aop_RuntimeExpressions'],
            '/Routes([^\/]*)\.yaml/' => ['Flow_Mvc_Routing_Route', 'Flow_Mvc_Routing_Resolve'],
            '/Views\.yaml/' => ['Flow_Mvc_ViewConfigurations']
        ];
        $cachesToFlush = [];
        foreach (array_keys($changedFiles) as $pathAndFilename) {
            foreach ($caches as $cacheFilePattern => $cacheNames) {
                if (preg_match($aopProxyClassInfluencers, $pathAndFilename) === 1) {
                    $aopProxyClassRebuildIsNeeded = true;
                }
                if (preg_match($cacheFilePattern, $pathAndFilename) !== 1) {
                    continue;
                }
                foreach ($caches[$cacheFilePattern] as $cacheName) {
                    $cachesToFlush[$cacheName] = $cacheFilePattern;
                }
            }
        }

        foreach ($cachesToFlush as $cacheName => $cacheFilePattern) {
            $this->logger->info(sprintf('A configuration file matching the pattern "%s" has been changed, flushing related cache "%s"', $cacheFilePattern, $cacheName), LogEnvironment::fromMethodName(__METHOD__));
            $this->getCache($cacheName)->flush();
        }

        $this->logger->info('A configuration file has been changed, refreshing compiled configuration cache', LogEnvironment::fromMethodName(__METHOD__));
        $this->configurationManager->refreshConfiguration();

        if ($aopProxyClassRebuildIsNeeded) {
            $this->logger->info('The configuration has changed, triggering an AOP proxy class rebuild.', LogEnvironment::fromMethodName(__METHOD__));
            $objectConfigurationCache->remove('allAspectClassesUpToDate');
            $objectConfigurationCache->remove('allCompiledCodeUpToDate');
            $objectClassesCache->flush();
        }
    }
1209648
public function flush()
    {
        Files::emptyDirectoryRecursively($this->cacheDirectory);
        if ($this->frozen === true) {
            @unlink($this->cacheDirectory . 'FrozenCache.data');
            $this->frozen = false;
        }
    }
325980
public function flush()
    {
        // this may take a while, but they shouldn't be flushing in production
        $cache_keys = $this->redis->keys(/* prefixed with cache: */ '*');

        foreach ($cache_keys as $key) {
            $this->redis->del($key);
        }

        unset($cache_keys);

        return true;
    }
92690
public function clearStatCache($all = false)
    {
        if ($all === false) {
            clearstatcache(true, $this->path);
        }

        clearstatcache();
    }
1358817
public function ignoreFiles($files) {
		if (! is_array ( $files )) {
			$files = func_get_args ();
		}
		$this->begin ();
		$this->run ( 'git reset', NULL, [ "--" => $files ] );
		return $this->end ();
	}
1302251
protected function flushCache(array $invalidates): void
    {
        if (\count($invalidates) > 0) {
            if ($this->cache instanceof AdapterInterface && null !== $this->context) {
                $this->cache->clearByPrefixes($invalidates);
            } elseif (null !== $this->cache) {
                $this->cache->clear();
            }

            if ($this->sim instanceof CacheSecurityIdentityManagerInterface) {
                $this->sim->invalidateCache();
            }
        }
    }
862188
public function clearCache($reactivateModules = true)
    {
        $this->routes = array();
        
        if ($reactivateModules) {
            $this->framework->getModuleManager()->reactivateModules();
        }
    }
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());
                        }
                    }
            }
        }
802887
public function flush()
    {
        $keys = $this->getCacheKeys();
        foreach ($keys as $key) {
            Cache::forget($this->makeCacheKey($key));
        }
        $this->removeKeys($keys);
    }
228213
public static void refreshedFiles(String[] filePaths) {
    for (String filePath : filePaths) {
      IFile file = CommonServices.getFileSystem().getIFile(new File(filePath));
      if (file != null) {
        TypeSystem.refreshed(file);
      }
    }
  }
1186826
public function flushAll()
    {
        $mask = '*' . self::CACHE_FILE_SUFFIX;

        foreach (glob($this->basePath . $mask) as $cacheFilePath) {
            if (!unlink($cacheFilePath)) {
                throw new \RuntimeException("Failed to delete cache file '{$cacheFilePath}'.");
            }
        }
    }
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);
            }
        }
    }
884654
protected function clearStatCache($all_files = false)
    {
        if(version_compare(PHP_VERSION, '5.3.0') >= 0)
        {
            if($all_files === true)
            {
                clearstatcache(true);
                return;
            }

            clearstatcache(true, $this->file_path);
            return;
        }
        clearstatcache();
    }
1131159
public function clearCacheCommand($parameters)
    {
        if (in_array($parameters['cacheCmd'], ['all', 'system'])) {
            $files = $this->getFilesInPath(self::GENERATED_FILES_PATH . '*');

            foreach ($files as $file) {
                $this->clearFile($file);
            }
        }
    }
925916
private function appendCollectedFileAndChanges(): void
    {
        if (!empty($this->currentFile)) {
            foreach ($this->currentChanges as $change) {
                $this->currentFile->addChange($change);
            }
            $this->files[] = $this->currentFile;
        }
        $this->currentChanges = [];
    }
63100
public function didChangeWatchedFiles(array $changes)
    {
        foreach ($changes as $change) {
            if ($change->type === FileChangeType::DELETED) {
                $this->client->textDocument->publishDiagnostics($change->uri, []);
            }
        }
    }
465774
public function deleteMulti(array $keys): void
    {
        if ($this->enabled === false) {
            return;
        }

        foreach ($keys as $index) {
            if ($key = $this->cacheIndex[$index] ?? null) {
                unset($this->cacheIndex[$index]);
            } else {
                $key = $index;
            }

            unset($this->cache[$key], $this->cacheExpiryTime[$key], $this->cacheAccessCount[$key]);
        }
    }