You are here

class MemcacheLockFactory in Memcache API and Integration 8.2

THe memcache lock factory.

Hierarchy

Expanded class hierarchy of MemcacheLockFactory

1 string reference to 'MemcacheLockFactory'
memcache.services.yml in ./memcache.services.yml
memcache.services.yml
1 service uses MemcacheLockFactory
memcache.lock.factory in ./memcache.services.yml
Drupal\memcache\Lock\MemcacheLockFactory

File

src/Lock/MemcacheLockFactory.php, line 10

Namespace

Drupal\memcache\Lock
View source
class MemcacheLockFactory {

  /**
   * The bin name for this lock.
   *
   * @var string
   */
  protected $bin = 'semaphore';

  /**
   * The memcache factory.
   *
   * @var \Drupal\memcache\Driver\MemcacheDriverFactory
   */
  protected $factory;

  /**
   * Constructs a new MemcacheLockFactory.
   *
   * @param \Drupal\memcache\Driver\MemcacheDriverFactory $memcache_factory
   *   The memcache factory.
   */
  public function __construct(MemcacheDriverFactory $memcache_factory) {
    $this->factory = $memcache_factory;
  }

  /**
   * Gets a lock backend instance.
   *
   * @return \Drupal\Core\Lock\LockBackendInterface
   *   A locked Memcache backend instance.
   */
  public function get() {
    return new MemcacheLockBackend($this->bin, $this->factory
      ->get($this->bin));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MemcacheLockFactory::$bin protected property The bin name for this lock.
MemcacheLockFactory::$factory protected property The memcache factory.
MemcacheLockFactory::get public function Gets a lock backend instance.
MemcacheLockFactory::__construct public function Constructs a new MemcacheLockFactory.