You are here

public function PhpRedis::__construct in Redis 8

Same name in this branch
  1. 8 src/Lock/PhpRedis.php \Drupal\redis\Lock\PhpRedis::__construct()
  2. 8 src/Flood/PhpRedis.php \Drupal\redis\Flood\PhpRedis::__construct()
  3. 8 src/Queue/PhpRedis.php \Drupal\redis\Queue\PhpRedis::__construct()
  4. 8 src/Cache/PhpRedis.php \Drupal\redis\Cache\PhpRedis::__construct()
  5. 8 src/PersistentLock/PhpRedis.php \Drupal\redis\PersistentLock\PhpRedis::__construct()

Creates a PHpRedis persistent lock backend.

Overrides PhpRedis::__construct

File

src/PersistentLock/PhpRedis.php, line 15

Class

PhpRedis
PHpRedis persistent lock backend

Namespace

Drupal\redis\PersistentLock

Code

public function __construct(ClientFactory $factory) {

  // Do not call the parent constructor to avoid registering a shutdown
  // function that releases all the locks at the end of a request.
  $this->client = $factory
    ->getClient();

  // Set the lockId to a fixed string to make the lock ID the same across
  // multiple requests. The lock ID is used as a page token to relate all the
  // locks set during a request to each other.
  // @see \Drupal\Core\Lock\LockBackendInterface::getLockId()
  $this->lockId = 'persistent';
}