src/MemCached.php
public function getMemcached()
    {
        if ($this->_cache === null) {
            if (!extension_loaded('memcached')) {
                throw new InvalidConfigException('MemCached requires PHP memcached extension to be loaded.');
            }

            $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)) {
                $this->_cache->setOptions($this->options);
            }
        }

        return $this->_cache;
    }
public function getMemcached()
    {
        if ($this->_cache === null) {
            if (!extension_loaded('memcached')) {
                throw new InvalidConfigException('MemCached requires PHP memcached extension to be loaded.');
            }

            $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)) {
                $this->_cache->setOptions($this->options);
            }
        }

        return $this->_cache;
    }
public function getMemcached ( ) { if ( $ this -> _cache === null ) { if ( ! extension_loaded ( 'memcached' ) ) { throw new InvalidConfigException ( 'MemCached requires PHP memcached extension to be loaded.' ) ; } $ 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 ) ) { $ this -> _cache -> setOptions ( $ this -> options ) ; } } return $ this -> _cache ; }
Returns the underlying memcached object.
@return \Memcached the memcached object used by this cache component.
@throws InvalidConfigException if memcached extension is not loaded
Returns the underlying memcached object .