You are here

class NullLockBackend in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Lock/NullLockBackend.php \Drupal\Core\Lock\NullLockBackend
  2. 9 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

  • class \Drupal\Core\Lock\NullLockBackend implements \Drupal\Core\Lock\LockBackendInterface

Expanded class hierarchy of NullLockBackend

Related topics

4 files declare their use of NullLockBackend
ExportStorageManagerTest.php in core/tests/Drupal/KernelTests/Core/Config/ExportStorageManagerTest.php
ImportStorageTransformerTest.php in core/tests/Drupal/KernelTests/Core/Config/ImportStorageTransformerTest.php
NormalInstallerServiceProvider.php in core/lib/Drupal/Core/Installer/NormalInstallerServiceProvider.php
ThemeExtensionListTest.php in core/tests/Drupal/Tests/Core/Extension/ThemeExtensionListTest.php

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(mt_rand(), TRUE);
    }
    return $this->lockId;
  }

}

Members