Example #1
0
 public function onProxyResponseError(Event $event)
 {
     $this->log(LogLevel::CRITICAL, $event->getException());
 }
 /**
  * Send all pending invalidation requests.
  *
  * @return int The number of cache invalidations performed per caching server.
  *
  * @throws ExceptionCollection If any errors occurred during flush.
  */
 public function flush()
 {
     try {
         return $this->cache->flush();
     } catch (ExceptionCollection $exceptions) {
         foreach ($exceptions as $exception) {
             $event = new Event();
             $event->setException($exception);
             if ($exception instanceof ProxyResponseException) {
                 $this->getEventDispatcher()->dispatch(Events::PROXY_RESPONSE_ERROR, $event);
             } elseif ($exception instanceof ProxyUnreachableException) {
                 $this->getEventDispatcher()->dispatch(Events::PROXY_UNREACHABLE_ERROR, $event);
             }
         }
         throw $exceptions;
     }
 }