Why does the Memcached driver use binary connections only when there is an account or password?

question

shouldn"t the connection method be the same with or without an account password?

when viewing the Memcached driver file of Yii2, it is found that a binary connection is made when there is an account password, otherwise a simple connection is made.

related

Yii2 version: 2.0.13
location: vendor/yiisoft/yii2/caching/MemCache.php:225

if ($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);
    }
Sep.03,2021

SASL is supported because of the Memcached binary protocol.

so the logic here is that you have to use a password and an account, so you have to open a binary protocol.

Menu