solution10 / circuitbreaker
Simple circuitbreaker class that uses Doctrine\Cache to persist state
Installs: 4 331
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >= 5.5
- doctrine/cache: ^1.0
Requires (Dev)
- phpunit/phpunit: ^4.0
- squizlabs/php_codesniffer: ^1.0
This package is not auto-updated.
Last update: 2024-11-07 02:29:39 UTC
README
Simple circuit breaker class.
Features
- Adjustable thresholds
- Adjustable cooldowns
- Events on change
- Any Doctine\Common\Cache\Cache implementation for persistence
Installation
Installation is via composer, in the usual manner:
$ composer require solution10/circuitbreaker
Example usage
<?php $persistence = new \Doctrine\Common\Cache\ArrayCache(); $breaker = new \Solution10\CircuitBreaker\CircuitBreaker('my_backend_service', $persistence); if ($breaker->isClosed()) { $response = doSomething(); if ($response) { $breaker->success(); } else { $breaker->failure(); } } else { gracefullyDegrade(); }
Userguide
(or the /docs folder in the repo)
PHP Requirements
- PHP >= 5.5