You are here

public function DrupalMemcache::__construct in Memcache Storage 8

Builds a new DrupalMemcache(d) object.

Parameters

array $settings: Array of Settings:get('memcache_storage') settings.

$cluster_name: Name of the memcached cluster. Default name is 'default'.

Overrides DrupalMemcachedBase::__construct

File

src/DrupalMemcache.php, line 55

Class

DrupalMemcache
Class DrupalMemcache

Namespace

Drupal\memcache_storage

Code

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']);
}