Skip to content
Permalink
Browse files

Add warnings if cache engine is ApcEngine or WincacheEngine

  • Loading branch information...
chris48s committed May 27, 2016
1 parent 6d8d7a7 commit 087c614f0c3d8ec8cb056b8570b4276ff00fc99c
Showing with 13 additions and 10 deletions.
  1. +13 −10 src/Shell/CacheShell.php
@@ -72,12 +72,20 @@ public function getOptionParser()
public function clear($prefix = null)
{
try {
$engine = Cache::engine($prefix);
Cache::clear(false, $prefix);
if ($engine instanceof \Cake\Cache\Engine\ApcEngine) {
$this->warn("ApcEngine detected: Cleared $prefix CLI cache successfully " .
"but $prefix web cache must be cleared separately.");
} elseif ($engine instanceof \Cake\Cache\Engine\WincacheEngine) {
$this->warn("WincacheEngine detected: Cleared $prefix CLI cache successfully " .
"but $prefix web cache must be cleared separately.");
} else {
$this->out("<success>Cleared $prefix cache</success>");
}
} catch (\InvalidArgumentException $e) {
$this->abort($e->getMessage());
}
$this->out("<success>Cleared $prefix cache</success>");
}
/**
@@ -87,14 +95,9 @@ public function clear($prefix = null)
*/
public function clearAll()
{
if (version_compare(Configure::version(), '3.2.0', '>=')) {
Cache::clearAll(false);
$this->out("<success>Cleared all caches</success>");
} else {
$prefixes = Cache::configured();
foreach ($prefixes as $prefix) {
$this->clear($prefix);
}
$prefixes = Cache::configured();
foreach ($prefixes as $prefix) {
$this->clear($prefix);
}
}

0 comments on commit 087c614

Please sign in to comment.
You can’t perform that action at this time.