Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
}
],
"require": {
"php": ">=5.3.0"
"php": ">=5.3.0",
"mouf/utils.composite-exception": "~1.0"
},
"autoload": {
"psr-0": {
Expand Down
22 changes: 16 additions & 6 deletions src/Mouf/Utils/Cache/Service/PurgeCacheService.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Mouf\MoufManager;

use Mouf\Mvc\Splash\Controllers\Controller;
use Mouf\Utils\CompositeException;

/**
* This service can purge the cache of ALL cache instances (implementing CacheInterface) declared in Mouf.
Expand All @@ -23,14 +24,23 @@ public static function purgeAll() {

$moufManager = MoufManager::getMoufManager();
$instances = $moufManager->findInstances("Mouf\\Utils\\Cache\\CacheInterface");


$compositeException = new CompositeException();

foreach ($instances as $instanceName) {
$cacheService = $moufManager->getInstance($instanceName);
/* @var $cacheService CacheInterface */

$cacheService->purgeAll();
try {
$cacheService = $moufManager->getInstance($instanceName);
/* @var $cacheService CacheInterface */

$cacheService->purgeAll();
} catch (\Exception $e) {
$compositeException->add($e);
}
}

if (!$compositeException->isEmpty()) {
throw $compositeException;
}

}

}
Expand Down