class NullLockBackend

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Lock/NullLockBackend.php \Drupal\Core\Lock\NullLockBackend
  2. 10 core/lib/Drupal/Core/Lock/NullLockBackend.php \Drupal\Core\Lock\NullLockBackend
  3. 9 core/lib/Drupal/Core/Lock/NullLockBackend.php \Drupal\Core\Lock\NullLockBackend
  4. 8.9.x core/lib/Drupal/Core/Lock/NullLockBackend.php \Drupal\Core\Lock\NullLockBackend

Defines a Null lock backend.

This implementation won't actually lock anything and will always succeed on lock attempts.

Hierarchy

Expanded class hierarchy of NullLockBackend

Related topics

10 files declare their use of NullLockBackend
CheckpointStorageTest.php in core/tests/Drupal/Tests/Core/Config/Checkpoint/CheckpointStorageTest.php
CronTest.php in core/tests/Drupal/Tests/Core/CronTest.php
ExportStorageManagerTest.php in core/tests/Drupal/KernelTests/Core/Config/ExportStorageManagerTest.php
ImportStorageTransformerTest.php in core/tests/Drupal/KernelTests/Core/Config/ImportStorageTransformerTest.php
LinearHistoryTest.php in core/tests/Drupal/Tests/Core/Config/Checkpoint/LinearHistoryTest.php

... See full list

File

core/lib/Drupal/Core/Lock/NullLockBackend.php, line 13

Namespace

Drupal\Core\Lock
View source
class NullLockBackend implements LockBackendInterface {
  
  /**
   * Current page lock token identifier.
   *
   * @var string
   */
  protected $lockId;
  
  /**
   * {@inheritdoc}
   */
  public function acquire($name, $timeout = 30.0) {
    return TRUE;
  }
  
  /**
   * {@inheritdoc}
   */
  public function lockMayBeAvailable($name) {
    return TRUE;
  }
  
  /**
   * {@inheritdoc}
   */
  public function wait($name, $delay = 30) {
  }
  
  /**
   * {@inheritdoc}
   */
  public function release($name) {
  }
  
  /**
   * {@inheritdoc}
   */
  public function releaseAll($lock_id = NULL) {
  }
  
  /**
   * {@inheritdoc}
   */
  public function getLockId() {
    if (!isset($this->lockId)) {
      $this->lockId = uniqid((string) mt_rand(), TRUE);
    }
    return $this->lockId;
  }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
NullLockBackend::$lockId protected property Current page lock token identifier.
NullLockBackend::acquire public function Overrides LockBackendInterface::acquire
NullLockBackend::getLockId public function Overrides LockBackendInterface::getLockId
NullLockBackend::lockMayBeAvailable public function Overrides LockBackendInterface::lockMayBeAvailable
NullLockBackend::release public function Overrides LockBackendInterface::release
NullLockBackend::releaseAll public function Overrides LockBackendInterface::releaseAll
NullLockBackend::wait public function Overrides LockBackendInterface::wait

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.