lib\utility\cacheservice.class.php
function _load() {
if (! class_exists ( 'memcache' ) || ! ($configs = $this->_config ())) {
return false;
}
$this->_object = new Memcache ();
if (method_exists ( $this->_object, 'addServer' )) {
foreach ( $configs as $config ) {
$this->_object->addServer ( $config ['host'], $config ['port'] );
}
} else {
$this->_object->connect ( $configs [0] ['host'], $configs [0] ['port'] );
}
}
加个false
function _load() {
if (! class_exists ( 'memcache' ) || ! ($configs = $this->_config ())) {
return false;
}
$this->_object = new Memcache ();
if (method_exists ( $this->_object, 'addServer' )) {
foreach ( $configs as $config ) {
$this->_object->addServer ( $config ['host'], $config ['port'],false);
}
} else {
$this->_object->connect ( $configs [0] ['host'], $configs [0] ['port'] );
}
}
大致的原因是 addServer 是长连接 导致只要开启n个php 进程 就有 n 个php进程于memcache 建立连接并保持连接 感觉这样不是很好