gpt4 book ai didi

php - mysql使用持久连接的目的和好处是什么?

转载 作者:行者123 更新时间:2023-11-29 02:44:41 25 4
gpt4 key购买 nike

根据php手册:

Persistent connections are not closed at the end of the script, but are cached and re-used when another script requests a connection using the same credentials. The persistent connection cache allows you to avoid the overhead of establishing a new connection every time a script needs to talk to a database, resulting in a faster web application.

一个优点是效率,我们不需要在每次脚本执行时都建立连接。持久连接的其他优点是什么?比如查询缓存等?

最佳答案

它允许跨多个请求恢复事务以及允许连接设置(例如字符集编码)持续存在

关于php - mysql使用持久连接的目的和好处是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44581377/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com