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.
        
    Namespace: Cake\Core\Retry
    
    
    
      
  
      Property Summary
- 
        $maxRetries protectedint
- 
        $numRetries protectedint
- 
        $strategy protectedCake\Core\Retry\RetryStrategyInterfaceThe strategy to follow should the executed action fail. 
Method Summary
- 
          __construct() publicCreates the CommandRetry object with the given strategy and retry count 
- 
          getRetries() publicReturns the last number of retry attemps. 
- 
          run() publicThe 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 
run() ¶ public
run(callable $action): mixedThe 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
Exception