Commit c5fbf89b by xjflyttp

- Enh #4520: yii\caching/MemCache.php add sasl support (xjflyttp)

parent 68fafdb4
...@@ -178,6 +178,7 @@ Yii Framework 2 Change Log ...@@ -178,6 +178,7 @@ Yii Framework 2 Change Log
- Enh: Added support for array attributes in `in` validator (creocoder) - Enh: Added support for array attributes in `in` validator (creocoder)
- Enh: Improved `yii\helpers\Inflector::slug` to support more cases for Russian, Hebrew and special characters (samdark) - Enh: Improved `yii\helpers\Inflector::slug` to support more cases for Russian, Hebrew and special characters (samdark)
- Enh: ListView now uses the widget ID in the base tag, consistent to gridview (cebe) - Enh: ListView now uses the widget ID in the base tag, consistent to gridview (cebe)
- Enh #4520: yii\caching/MemCache.php add sasl support (xjflyttp)
- Chg #2287: Split `yii\db\ColumnSchema::typecast()` into two methods `phpTypecast()` and `dbTypecast()` to allow specifying PDO type explicitly (cebe) - Chg #2287: Split `yii\db\ColumnSchema::typecast()` into two methods `phpTypecast()` and `dbTypecast()` to allow specifying PDO type explicitly (cebe)
- Chg #2898: `yii\console\controllers\AssetController` is now using hashes instead of timestamps (samdark) - Chg #2898: `yii\console\controllers\AssetController` is now using hashes instead of timestamps (samdark)
- Chg #2913: RBAC `DbManager` is now initialized via migration (samdark) - Chg #2913: RBAC `DbManager` is now initialized via migration (samdark)
......
...@@ -84,6 +84,17 @@ class MemCache extends Cache ...@@ -84,6 +84,17 @@ class MemCache extends Cache
public $options; public $options;
/** /**
* @var string memcached sasl username
* @see http://php.net/manual/en/memcached.setsaslauthdata.php
*/
public $username;
/**
* @var string memcached sasl password
* @see http://php.net/manual/en/memcached.setsaslauthdata.php
*/
public $password;
/**
* @var \Memcache|\Memcached the Memcache instance * @var \Memcache|\Memcached the Memcache instance
*/ */
private $_cache = null; private $_cache = null;
...@@ -201,6 +212,10 @@ class MemCache extends Cache ...@@ -201,6 +212,10 @@ class MemCache extends Cache
if ($this->useMemcached) { if ($this->useMemcached) {
$this->_cache = $this->persistentId !== null ? new \Memcached($this->persistentId) : new \Memcached; $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);
}
if (!empty($this->options)) { if (!empty($this->options)) {
$this->_cache->setOptions($this->options); $this->_cache->setOptions($this->options);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment