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 the action should be retried.
Property Summary
- $maxRetries protected
int - $numRetries protected
int - $strategy protected
Cake\Core\Retry\RetryStrategyInterfaceThe strategy to follow should the executed action fail.
Method Summary
-
__construct() public
Creates the CommandRetry object with the given strategy and retry count
-
getRetries() public
Returns the last number of retry attemps.
-
run() public
The number of retries to perform in case of failure
Method Detail
__construct() public
__construct(Cake\Core\Retry\RetryStrategyInterface $strategy, int $maxRetries = 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
-
int$maxRetries optional The maximum number of retry attempts allowed
getRetries() public
getRetries(): int
Returns the last number of retry attemps.
Returns
intrun() public
run(callable $action): mixed
The number of retries to perform in case of failure
Parameters
-
callable$action The callable action to execute with a retry strategy
Returns
mixedThrows
ExceptionProperty Detail
$maxRetries protected
Type
int$numRetries protected
Type
int$strategy protected
The strategy to follow should the executed action fail.
Type
Cake\Core\Retry\RetryStrategyInterface
© 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/4.4/class-Cake.Core.Retry.CommandRetry.html