mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 15:02:47 +08:00
memcached驱动的配置参数支持option参数
This commit is contained in:
4
library/think/cache/driver/Memcached.php
vendored
4
library/think/cache/driver/Memcached.php
vendored
@@ -24,6 +24,7 @@ class Memcached extends Driver
|
|||||||
'prefix' => '',
|
'prefix' => '',
|
||||||
'username' => '', //账号
|
'username' => '', //账号
|
||||||
'password' => '', //密码
|
'password' => '', //密码
|
||||||
|
'option' => [],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,6 +41,9 @@ class Memcached extends Driver
|
|||||||
$this->options = array_merge($this->options, $options);
|
$this->options = array_merge($this->options, $options);
|
||||||
}
|
}
|
||||||
$this->handler = new \Memcached;
|
$this->handler = new \Memcached;
|
||||||
|
if (!empty($this->options['option'])) {
|
||||||
|
$this->handler->setOptions($this->options['option']);
|
||||||
|
}
|
||||||
// 设置连接超时时间(单位:毫秒)
|
// 设置连接超时时间(单位:毫秒)
|
||||||
if ($this->options['timeout'] > 0) {
|
if ($this->options['timeout'] > 0) {
|
||||||
$this->handler->setOption(\Memcached::OPT_CONNECT_TIMEOUT, $this->options['timeout']);
|
$this->handler->setOption(\Memcached::OPT_CONNECT_TIMEOUT, $this->options['timeout']);
|
||||||
|
|||||||
Reference in New Issue
Block a user