/** * {@inheritdoc} */ public function __construct(array $settings, $cluster_name) { parent::__construct($settings, $cluster_name); // For more information see // http://www.php.net/manual/en/memcache.setcompressthreshold.php. if (!empty($settings['compress_threshold'])) { $this->compressThreshold = $settings['compress_threshold']; } if (isset($this->compressThreshold['threshold']) && isset($this->compressThreshold['min_savings'])) { $this->memcached->setCompressThreshold($this->compressThreshold['threshold'], $this->compressThreshold['min_savings']); } // See http://php.net/manual/en/memcache.addserver.php $this->persistentConnection = !empty($settings['persistent_connection']); // See http://php.net/manual/en/memcache.set.php $this->compressionEnabled = !empty($settings['compression_enabled']); }
/** * {@inheritdoc} */ public function __construct(array $settings, $cluster_name) { parent::__construct($settings, $cluster_name); // For more info about memcached constants see // http://www.php.net/manual/en/memcached.constants.php. $this->options = !empty($settings['memcached_options']) ? $settings['memcached_options'] : []; $this->options += $this->optionsDefault; // Add SASL support. // See http://php.net/manual/en/memcached.setsaslauthdata.php if (!empty($this->settings['sasl_auth']['user']) && !empty($this->settings['sasl_auth']['password'])) { $this->memcached->setSaslAuthData($this->settings['sasl_auth']['user'], $this->settings['sasl_auth']['password']); // SASL auth works only with binary protocol. $this->options[\Memcached::OPT_BINARY_PROTOCOL] = TRUE; } // Set pecl memcached options. // See http://php.net/manual/en/memcached.setoptions.php $this->memcached->setOptions($this->options); }