/** * 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 typo3.flow:cache:flush * @see typo3.flow:configuration:show */ public function flushOneCommand($identifier) { if (!$this->cacheManager->hasCache($identifier)) { $this->outputLine('The cache "%s" does not exist.', array($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"?', array($closestIdentifier)); } $this->quit(1); } $this->cacheManager->getCache($identifier)->flush(); $this->outputLine('Flushed "%s" cache for "%s" context.', array($identifier, $this->bootstrap->getContext())); $this->sendAndExit(0); }