Download the PHP package janfish/phalcon-db-reconnection without Composer
On this page you can find all versions of the php package janfish/phalcon-db-reconnection. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download janfish/phalcon-db-reconnection
More information about janfish/phalcon-db-reconnection
Files in janfish/phalcon-db-reconnection
Download janfish/phalcon-db-reconnection
More information about janfish/phalcon-db-reconnection
Files in janfish/phalcon-db-reconnection
Vendor janfish
Package phalcon-db-reconnection
Short Description Reconnect MYSQL when the database loses connection
License MIT
Package phalcon-db-reconnection
Short Description Reconnect MYSQL when the database loses connection
License MIT
Please rate this library. Is it a good library?
Informations about the package phalcon-db-reconnection
场景
- 常驻内存程序使用,解决长时间不操作造成的掉线、抛异常、程序退出
原理
- 客户端连接在MYSQL设置的interactive_timeout之间内没有任何操作,会被主动断开,造成操作报错
- 捕捉数据库出现的CR_SERVER_GONE_ERROR、CR_SERVER_LOST两类报错,并自动重连,并重新执行之前想执行的SQL操作
- 如果判定为事务进行中的写操作,不断线重连,防止破坏事务一致性,但会对事务begin就引起的掉线发起重连
使用
析构函数增加了max_retry_connect参数,申明最大重连次数,此参数默认值2
参考资料
https://dev.mysql.com/doc/refman/5.7/en/client-error-reference.html#error_cr_server_gone_error https://dev.mysql.com/doc/refman/5.7/en/client-error-reference.html#error_cr_server_lost
All versions of phalcon-db-reconnection with dependencies
PHP Build Version
Package Version
Requires
php Version
>=7.0.0
ext-phalcon Version 3.4.*
ext-pdo Version *
ext-phalcon Version 3.4.*
ext-pdo Version *
The package janfish/phalcon-db-reconnection contains the following files
Loading the files please wait ....