Last active
August 29, 2015 14:04
-
-
Save andrioid/2e284e26beff03e55d7f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
interface ICircuitBreakerStorage { | |
} | |
class CircuitBreaker { | |
/** | |
* StorageImplemntation should be a defined interface. | |
**/ | |
public function __construct(ICircuitBreakerStorage $storageImplementation=null) { | |
if ($storageImplementation==null) { | |
// default engine | |
} | |
} | |
/** | |
* Check failure threshold, return a CircuitBreakerException if reached. | |
* Otherwise catch exceptions and store them. Run anonymous functions. | |
* | |
* Key identifies the service you're shielding. "Payment" could be an example. | |
* | |
**/ | |
public function run($key, Callable $callback) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment