Makes sure the connection to the database is alive before authorizing the retry of an action.
array<string>
The list of error strings to match when looking for a disconnection error.
Cake\Database\Connection
The connection to check for validity
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.
Tries to re-establish the connection to the server, if it is safe to do so
Returns true if the action can be retried, false otherwise.
__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.
Cake\Database\Connection
$connection The connection to check
reconnect(): bool
Tries to re-establish the connection to the server, if it is safe to do so
bool
shouldRetry(Exception $exception, int $retryCount): bool
Returns true if the action can be retried, false otherwise.
Checks whether the exception was caused by a lost connection, and returns true if it was able to successfully reconnect.
Exception
$exception int
$retryCount bool
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.
array<string>
The connection to check for validity
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.4/class-Cake.Database.Retry.ReconnectStrategy.html