承接 jdomenechb/renew-doctrine-connection 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jdomenechb/renew-doctrine-connection

最新稳定版本:v1.0

Composer 安装命令:

composer require jdomenechb/renew-doctrine-connection

包简介

Renews Doctrine DBAL connections that have been closed or timed out.

README 文档

README

This library eases the process of renewing an existing Doctrine connection in your application that has been closed due to a timeout from the server. This might happen when the connection expires or the server has become unavailable.

When the connection is lost, the application usually throws an error like (in MySQL):

SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

It is recommended to install this library only in daemons, consumers, PHP-only servers or very long processes, that is, any PHP project that relies solely in a lengthy PHP process to run. That does not include normal PHP applications running in web servers like Nginx or Apache, unless they have expensive algorythtms that rely on the database. Otherwise, you might be suffering some undesired overhead in your application.

Installation

Add this library to your project using Composer:

composer require jdomenechb/renew-doctrine-connection

Configuration

Modify your Doctrine configuration to use the TimedRenewConnection contained in this library as the wrapper class of Doctrine. In Symfony, for example, configuration will look like:

doctrine:
    dbal:
        # ...
        wrapper_class: 'Jdomenechb\Doctrine\DBAL\TimedRenewConnection'
        options:
            secondsToRenew: 60

You can freely customize the parameter secondsToRenew. The database connection will be renewed only after the seconds of inactivity you specify in this parameter. If it is set to 0 or not set at all, the connection will be renewed before every operation performed to the database.

For example, a good value to assign to this parameter, in MySQL, is the value of the MySQL system variable wait_timeout.

统计信息

  • 总下载量: 6.19k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-09-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固