Class ReconnectStrategy
Makes sure the connection to the database is alive before authorizing the retry of an action.
Properties summary
- $causes protected static
array
The list of error strings to match when looking for a disconnection error.
- $connection protected
\Cake\Database\Connection
The connection to check for validity
Method Summary
- __construct() public
Creates the ReconnectStrategy object by storing a reference to the passed connection. This reference will be used to automatically reconnect to the server in case of failure.
Method Detail
__construct() public
__construct(\Cake\Database\Connection $connection)
Creates the ReconnectStrategy object by storing a reference to the passed connection. This reference will be used to automatically reconnect to the server in case of failure.
Parameters
-
\Cake\Database\Connection
$connection The connection to check
reconnect() protected
reconnect()
Tries to re-establish the connection to the server, if it is safe to do so
Returns
bool
Whether or not the connection was re-established
shouldRetry() public
shouldRetry(\Exception $exception, int $retryCount)
Returns true if the action can be retried, false otherwise.
Parameters
-
\Exception
$exception The exception that caused the action to fail
-
int
$retryCount The number of times action has been retried
Returns
bool
Whether or not it is OK to retry the action
Property Detail
$causes protected static
The list of error strings to match when looking for a disconnection error.
This is a static variable to enable opcache to inline the values.
Type
array
$connection protected
The connection to check for validity
Type
\Cake\Database\Connection
© 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.1/class-Cake.Database.Retry.ReconnectStrategy.html