mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 23:02:48 +08:00
支持集成环境
This commit is contained in:
13
library/think/cache/driver/memcache.php
vendored
13
library/think/cache/driver/memcache.php
vendored
@@ -40,9 +40,16 @@ class Memcache {
|
|||||||
}
|
}
|
||||||
$func = $this->options['persistent'] ? 'pconnect' : 'connect';
|
$func = $this->options['persistent'] ? 'pconnect' : 'connect';
|
||||||
$this->handler = new \Memcache;
|
$this->handler = new \Memcache;
|
||||||
$options['timeout'] === false ?
|
// 支持集群
|
||||||
$this->handler->$func($options['host'], $options['port']) :
|
$hosts = explode(',', $this->options['host']);
|
||||||
$this->handler->$func($options['host'], $options['port'], $options['timeout']);
|
$ports = explode(',', $this->options['port']);
|
||||||
|
|
||||||
|
foreach((array) $hosts as $i=>$host){
|
||||||
|
$port = isset($ports[$i]) ? $ports[$i] : $ports[0];
|
||||||
|
$options['timeout'] === false ?
|
||||||
|
$this->handler->addServer($host, $port, $this->options['persistent'], 1) :
|
||||||
|
$this->handler->addServer($host, $port, $this->options['persistent'], 1, $this->options['timeout']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user