class LockFactory in Redis 8
Lock backend singleton handling.
Hierarchy
- class \Drupal\redis\Lock\LockFactory
Expanded class hierarchy of LockFactory
1 string reference to 'LockFactory'
1 service uses LockFactory
File
- src/
Lock/ LockFactory.php, line 10
Namespace
Drupal\redis\LockView source
class LockFactory {
/**
* @var \Drupal\redis\ClientInterface
*/
protected $clientFactory;
/**
* Creates a redis LockFactory.
*/
public function __construct(ClientFactory $client_factory) {
$this->clientFactory = $client_factory;
}
/**
* Get actual lock backend.
*
* @param bool $persistent
* (optional) Whether to return a persistent lock implementation or not.
*
* @return \Drupal\Core\Lock\LockBackendInterface
* Return lock backend instance.
*/
public function get($persistent = FALSE) {
$class_name = $this->clientFactory
->getClass($persistent ? ClientFactory::REDIS_IMPL_PERSISTENT_LOCK : ClientFactory::REDIS_IMPL_LOCK);
return new $class_name($this->clientFactory);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LockFactory:: |
protected | property | ||
LockFactory:: |
public | function | Get actual lock backend. | |
LockFactory:: |
public | function | Creates a redis LockFactory. |