:elephant: A Circuit Breaker pattern implementation for PHP applications.
Fix backward incompatibility in v1.2.1 by ackintosh · Pull Request #81 · ackintosh/ganesha
This release is to ease the backward incompatibility in 1.2.1.
Unfortunately this release does not completely fix the incompatibility. If you are using your custom adapter, please add setContext
method like below in order to keep behaviors of your adapter.
If your custom adapter extends a built in adapter like below, it is recommended to use the parent implementation:
class CustomAdapter extends \Ackintosh\Ganesha\Storage\Adapter\Memcached
{
// Comment out to use the parent implementation
// public function setContext(Ganesha\Context $context): void
// {
// }
}
or if your custom adapter using no built in adapter, please add an empty setContext
method to satisfy AdapterInterface requirement.
class CustomAdapter implements \Ackintosh\Ganesha\Storage\AdapterInterface
{
public function setContext(Ganesha\Context $context): void
{
// nop
}
}
I'm excited to announce v1.0.0 - the first major release of Ganesha. 🎉 🎉
This release comes with breaking changes. Please refer to the following for details.
Support for the versions that reached the EOL has been dropped.
To make Ganesha more developer-friendly, the way how to pass build parameters has been changed, from an associative array to builder methods.
// Rate strategy
$ganesha = Ackintosh\Ganesha\Builder::build([
'timeWindow' => 30,
'failureRateThreshold' => 90,
'minimumRequests' => 10,
'intervalToHalfOpen' => 5,
'adapter' => new Ackintosh\Ganesha\Storage\Adapter\Memcached($memcached),
]);
// Count strategy
$ganesha = Ackintosh\Ganesha\Builder::buildwithCountStrategy([
'failureCountThreshold' => 100,
'intervalToHalfOpen' => 5,
'adapter' => new Ackintosh\Ganesha\Storage\Adapter\Memcached($memcached),
]);
// Rate strategy
$ganesha = Ackintosh\Ganesha\Builder::withRateStrategy()
->timeWindow(30)
->failureRateThreshold(90)
->minimumRequests(10)
->intervalToHalfOpen(5)
->adapter(new Ackintosh\Ganesha\Storage\Adapter\Memcached($memcached))
->build();
// Count strategy
$ganesha = Ackintosh\Ganesha\Builder::withCountStrategy()
->failureCountThreshold(100)
->intervalToHalfOpen(5)
->adapter(new Ackintosh\Ganesha\Storage\Adapter\Memcached($memcached))
->build();
Thank you for using Ganesha! ✨🐘✨
If you want customize the keys to be used when storing circuit breaker information, set an instance which implements StorageKeysInterface.
class YourStorageKeys implements StorageKeysInterface
{
public function prefix()
{
return 'your_prefix_';
}
// (ommitted)
}
$ganesha = Ackintosh\Ganesha\Builder::build([
// The keys which will stored by Ganesha to the storage you specified via `adapter`
// will be prefixed with `your_prefix_`.
'storageKeys' => new YourStorageKeys(),
]);
Even though Guzzle is not a core library for Ganesha, it was specified as required dependency. That is useless dependency for developers who wants to use only Ganesha without Guzzle.
From this release, Guzzle is specified "suggest" section in composer.json instead of "require-dev".