Router failure to write to redis should not cause a crash.

This commit is contained in:
Greyscale 2020-11-20 21:24:27 +01:00
parent 30d3ba6a0f
commit 0862121586
No known key found for this signature in database
GPG key ID: C6178C19949CFFE3

View file

@ -3,6 +3,7 @@
namespace Benzine\Router;
use Cache\Adapter\Chain\CachePoolChain;
use Cache\Adapter\Common\Exception\CachePoolException;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\AnnotationRegistry;
use Monolog\Logger;
@ -152,7 +153,12 @@ class Router
->set($this->getRoutes())
->expiresAfter($this->cacheTTL)
;
$this->cachePoolChain->save($routeItem);
try {
$this->cachePoolChain->save($routeItem);
}catch(CachePoolException $cachePoolException){
$this->logger->critical($cachePoolException->getMessage());
}
return $this;
}