You are here

class MemcacheBackendFactory in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 modules/memcache/src/MemcacheBackendFactory.php \Drupal\memcache\MemcacheBackendFactory

Class DatabaseBackendFactory.

Hierarchy

Expanded class hierarchy of MemcacheBackendFactory

1 file declares its use of MemcacheBackendFactory
MemcacheBackendUnitTest.php in modules/memcache/src/Tests/MemcacheBackendUnitTest.php
Contains \Drupal\memcache\Tests\MemcacheBackendUnitTest.
1 string reference to 'MemcacheBackendFactory'
memcache.services.yml in modules/memcache/memcache.services.yml
modules/memcache/memcache.services.yml
1 service uses MemcacheBackendFactory
cache.backend.memcache in modules/memcache/memcache.services.yml
Drupal\memcache\MemcacheBackendFactory

File

modules/memcache/src/MemcacheBackendFactory.php, line 17
Contains \Drupal\memcache\MemcacheBackendFactory.

Namespace

Drupal\memcache
View source
class MemcacheBackendFactory {

  /**
   * The lock backend that should be used.
   *
   * @var \Drupal\Core\Lock\LockBackendInterface
   */
  protected $lock;

  /**
   * The settings object.
   *
   * @var \Drupal\Core\Site\Settings
   */
  protected $settings;

  /**
   * The memcache factory object.
   *
   * @var \Drupal\memcache\DrupalMemcacheFactory
   */
  protected $memcacheFactory;

  /**
   * The cache tags checksum provider.
   *
   * @var \Drupal\Core\Cache\CacheTagsChecksumInterface
   */
  protected $checksumProvider;

  /**
   * Constructs the DatabaseBackendFactory object.
   *
   * @param \Drupal\Core\Lock\LockBackendInterface $lock
   * @param \Drupal\Core\Site\Settings $settings
   * @param \Drupal\memcache\DrupalMemcacheFactory $memcache_factory
   */
  function __construct(LockBackendInterface $lock, Settings $settings, DrupalMemcacheFactory $memcache_factory, CacheTagsChecksumInterface $checksum_provider) {
    $this->lock = $lock;
    $this->settings = $settings;
    $this->memcacheFactory = $memcache_factory;
    $this->checksumProvider = $checksum_provider;
  }

  /**
   * Gets MemcacheBackend for the specified cache bin.
   *
   * @param $bin
   *   The cache bin for which the object is created.
   *
   * @return \Drupal\memcache\MemcacheBackend
   *   The cache backend object for the specified cache bin.
   */
  public function get($bin) {
    return new MemcacheBackend($bin, $this->memcacheFactory
      ->get($bin), $this->lock, $this->settings, $this->checksumProvider);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MemcacheBackendFactory::$checksumProvider protected property The cache tags checksum provider.
MemcacheBackendFactory::$lock protected property The lock backend that should be used.
MemcacheBackendFactory::$memcacheFactory protected property The memcache factory object.
MemcacheBackendFactory::$settings protected property The settings object.
MemcacheBackendFactory::get public function Gets MemcacheBackend for the specified cache bin.
MemcacheBackendFactory::__construct function Constructs the DatabaseBackendFactory object.