問題無論有沒有賬號密碼,連接方式不都應(yīng)該是統(tǒng)一的嗎?在查看 Yii2 的 Memcached 驅(qū)動文件時,發(fā)現(xiàn)在有賬號密碼的情況下,進(jìn)行二進(jìn)制連接,否則進(jìn)行的是簡單連接。相關(guān)Yii2 版本:2.0.13位置:vendor/yiisoft/yii2/caching/MemCache.php:225if ($this->useMemcached) { $this->_cache = $this->persistentId !== null ? new \Memcached($this->persistentId) : new \Memcached(); if ($this->username !== null || $this->password !== null) { $this->_cache->setOption(\Memcached::OPT_BINARY_PROTOCOL, true); $this->_cache->setSaslAuthData($this->username, $this->password);
}
1 回答

汪汪一只貓
TA貢獻(xiàn)1898條經(jīng)驗 獲得超8個贊
因為Memcached二進(jìn)制協(xié)議才支持SASL。
所以這里的邏輯是,你要用密碼和賬號,所以要開二進(jìn)制協(xié)議。
- 1 回答
- 0 關(guān)注
- 562 瀏覽
添加回答
舉報
0/150
提交
取消