You are here

public function MemcachedBackendFactory::get in Memcache Storage 8

Gets MemcacheBackend for the specified cache bin.

Parameters

$bin: The cache bin for which the object is created.

Return value

\Drupal\memcache_storage\MemcachedBackend The cache backend object for the specified cache bin.

File

src/MemcachedBackendFactory.php, line 47

Class

MemcachedBackendFactory

Namespace

Drupal\memcache_storage

Code

public function get($bin) {

  // Prepopulate each cache bin name with the specific prefix to have a clear
  // and human readable cache bin names everywhere.
  $bin_name = 'cache_' . $bin;

  // Get DrupalMemcache or DrupalMemcached object for the specified bin.
  $memcached = $this->memcachedFactory
    ->get($bin_name);

  // Initialize a new object for a class that handles Drupal-specific part
  // of memcached cache backend.
  return new MemcachedBackend($bin_name, $memcached, $this->settings, $this->checksumProvider);
}