Class CommandRetry
Allows any action to be retried in case of an exception.
This class can be parametrized with a strategy, which will be followed to determine whether or not the action should be retried.
Properties summary
-
$retries
protectedThe number of retries to perform in case of failure.integer
-
$strategy
protected
Method Summary
- __construct() publicCreates the CommandRetry object with the given strategy and retry count
- run() publicThe number of retries to perform in case of failure
Method Detail
__construct()source public
__construct( Cake\Core\Retry\RetryStrategyInterface $strategy , integer $retries = 1 )
Creates the CommandRetry object with the given strategy and retry count
Parameters
-
Cake\Core\Retry\RetryStrategyInterface
$strategy
- The strategy to follow should the action fail
- integer
$retries
optional 1 - The number of times the action has been already called
run()source public
run( callable $action )
The number of retries to perform in case of failure
Parameters
- callable
$action
- The callable action to execute with a retry strategy
Returns
mixedThe return value of the passed action callable
Throws
ExceptionProperties detail
$strategysource
protected Cake\Core\Retry\RetryStrategyInterface
The strategy to follow should the executed action fail.
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.6/class-Cake.Core.Retry.CommandRetry.html