【发布时间】:2010-05-22 18:15:45
【问题描述】:
我有以下代码:
function failureCallback($host, $port) {
print "memcache '$host:$port' failed";
}
$this->memcache = new Memcache;
## bool Memcache::addServer ( string $host [, int $port = 11211 [, bool $persistent [, int $weight [, int $timeout [, int $retry_interval [, bool $status [, callback $failure_callback [, int $timeoutms ]]]]]]]] )
$this->memcache->addServer('192.168.1.35', '11211', FALSE, 50, 10, 10, TRUE, 'failureCallback' );
服务器在线并正在运行(已验证!),但在每次连接时都会调用失败回调函数。这是为什么呢?
参考:
PHP documentation: Memcache::addServer -> failure_callback
允许用户指定回调 遇到一个运行的函数 错误。回调在之前运行 尝试故障转移。功能 接受两个参数,主机名和 故障服务器的端口
编辑:在回调函数之前使用正确数量的参数更新了帖子,但没有任何运气:(
【问题讨论】:
标签: php function callback memcached