PHP code example of tleckie / circuit-breaker
1. Go to this page and download the library: Download tleckie/circuit-breaker library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tleckie / circuit-breaker example snippets
Tleckie\CircuitBreaker\CircuitBreaker;
use Tleckie\CircuitBreaker\Exception\CircuitBreakerException;
$circuitBreaker = new CircuitBreaker(
// Psr\SimpleCache\CacheInterface object, not rvice(
static function () use ($service) {
try {
return $service->users();
} catch (ServiceTimeOutException $exception) {
throw new CircuitBreakerException($exception);
}
},
'my.user.service'
);