You are here

public function DriverBase::__construct in Memcache API and Integration 8.2

Constructs a DriverBase object.

Parameters

\Drupal\memcache\MemcacheSettings $settings: The memcache config object.

\Memcached|\Memcache $memcache: An existing memcache connection object.

string $bin: The class instance specific cache bin to use.

File

src/Driver/DriverBase.php, line 66

Class

DriverBase
Class DriverBase.

Namespace

Drupal\memcache\Driver

Code

public function __construct(MemcacheSettings $settings, $memcache, $bin = NULL) {
  $this->settings = $settings;
  $this->memcache = $memcache;
  $this->hashAlgorithm = $this->settings
    ->get('key_hash_algorithm', 'sha1');
  $prefix = $this->settings
    ->get('key_prefix', '');
  if ($prefix) {
    $this->prefix = $prefix . ':';
  }
  if ($bin) {
    $this->prefix .= $bin . ':';
  }
}