php 中使用memcached扩展来访问memcached时,当memcached服务器无法正常连接,在默认设置下会造成请求响应变慢。注意:无法正常连接指网络故障,如两台服务器无法进行通信等,只要能ping通,就算memcached服务没有开启或down掉,不会影响响应时间,只是memca
php 中使用memcached扩展来访问memcached时,当memcached服务器无法正常连接,在默认设置下会造成请求响应变慢。注意:无法正常连接指网络故障,如两台服务器无法进行通信等,只要能ping通,就算memcached服务没有开启或down掉,不会影响响应时间,只是memcached没有启作用。
设置timeout时间通过常量Memcached::OPT_CONNECT_TIMEOUT来控制,默认是4000毫秒(php 官网显示1000,我测试版本1.0.2和2.0.1都是4000)。另外1.0.2和2.0.1还有很大差别。1.0.2在执行addServer时就会连接memcached服务器,而且执行命令时候需要2倍的timeout时间,所有当memcached无法连接时候,花费时间是3倍的timeout时间。
2.0.1在php 5.2中似乎有bug,无法使用,具体参看:https://bugs.php.net/bug.php?id=61283。
原文地址:php memcached 扩展 timeout 问题, 感谢原作者分享。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 English version
Recommended: Win version, supports code prompts!

Atom editor mac version download
The most popular open source editor