/** * @param $fileMonitorIdentifier * @param array $changedFiles * @return void */ public function flushContentCacheOnFileChanges($fileMonitorIdentifier, array $changedFiles) { $fileMonitorsThatTriggerContentCacheFlush = array('TYPO3CR_NodeTypesConfiguration', 'TypoScript_Files', 'Fluid_TemplateFiles', 'Flow_ClassFiles', 'Flow_ConfigurationFiles', 'Flow_TranslationFiles'); if (in_array($fileMonitorIdentifier, $fileMonitorsThatTriggerContentCacheFlush)) { $this->flowCacheManager->getCache('Neos_Fusion_Content')->flush(); } }
/** * @param LifecycleEventArgs $eventArgs * @return void */ public function postRemove(LifecycleEventArgs $eventArgs) { $entity = $eventArgs->getEntity(); if ($entity instanceof ImageInterface) { /** @var PersistentResource $resource */ $resource = $eventArgs->getEntity()->getResource(); if ($resource !== null) { $this->cacheManager->getCache('TYPO3_Media_ImageSize')->remove($resource->getCacheEntryIdentifier()); } } }
/** * Explicitly compile proxy classes * * The compile command triggers the proxy class compilation. * Although a compilation run is triggered automatically by Flow, there might * be cases in a production context where a manual compile run is needed. * * @Flow\Internal * @param boolean $force If set, classes will be compiled even though the cache says that everything is up to date. * @return void */ public function compileCommand($force = false) { /** @var VariableFrontend $objectConfigurationCache */ $objectConfigurationCache = $this->cacheManager->getCache('Flow_Object_Configuration'); if ($force === false) { if ($objectConfigurationCache->has('allCompiledCodeUpToDate')) { return; } } /** @var PhpFrontend $classesCache */ $classesCache = $this->cacheManager->getCache('Flow_Object_Classes'); $this->proxyClassCompiler->injectClassesCache($classesCache); $this->aopProxyClassBuilder->injectObjectConfigurationCache($objectConfigurationCache); $this->aopProxyClassBuilder->build(); $this->dependencyInjectionProxyClassBuilder->build(); $classCount = $this->proxyClassCompiler->compile(); $dataTemporaryPath = $this->environment->getPathToTemporaryDirectory(); Files::createDirectoryRecursively($dataTemporaryPath); file_put_contents($dataTemporaryPath . 'AvailableProxyClasses.php', $this->proxyClassCompiler->getStoredProxyClassMap()); $objectConfigurationCache->set('allCompiledCodeUpToDate', true); $classesCacheBackend = $classesCache->getBackend(); if ($this->bootstrap->getContext()->isProduction() && $classesCacheBackend instanceof FreezableBackendInterface) { /** @var FreezableBackendInterface $backend */ $backend = $classesCache->getBackend(); $backend->freeze(); } $this->emitFinishedCompilationRun($classCount); }
/** * Flushes a particular cache by its identifier * * Given a cache identifier, this flushes just that one cache. To find * the cache identifiers, you can use the configuration:show command with * the type set to "Caches". * * Note that this does not have a force-flush option since it's not * meant to remove temporary code data, resulting into a broken state if * code files lack. * * @param string $identifier Cache identifier to flush cache for * @return void * @see neos.flow:cache:flush * @see neos.flow:configuration:show */ public function flushOneCommand($identifier) { if (!$this->cacheManager->hasCache($identifier)) { $this->outputLine('The cache "%s" does not exist.', [$identifier]); $cacheConfigurations = $this->cacheManager->getCacheConfigurations(); $shortestDistance = -1; foreach (array_keys($cacheConfigurations) as $existingIdentifier) { $distance = levenshtein($existingIdentifier, $identifier); if ($distance <= $shortestDistance || $shortestDistance < 0) { $shortestDistance = $distance; $closestIdentifier = $existingIdentifier; } } if (isset($closestIdentifier)) { $this->outputLine('Did you mean "%s"?', [$closestIdentifier]); } $this->quit(1); } $this->cacheManager->getCache($identifier)->flush(); $this->outputLine('Flushed "%s" cache for "%s" context.', [$identifier, $this->bootstrap->getContext()]); $this->sendAndExit(0); }
/** * @return void */ protected function flushConfigurationCache() { $this->cacheManager->getCache('TYPO3_Neos_Configuration_Version')->flush(); }
/** * Injects the Cache Manager because we cannot inject an automatically factored cache during compile time. * * @param CacheManager $cacheManager * @return void */ public function injectCacheManager(CacheManager $cacheManager) { $this->methodPermissionCache = $cacheManager->getCache('Flow_Security_Authorization_Privilege_Method'); }