You are here

class NullLockBackend in Service Container 7

Same name and namespace in other branches
  1. 7.2 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

File

lib/Drupal/Core/Lock/NullLockBackend.php, line 18
Contains \Drupal\Core\Lock\NullLockBackend.

Namespace

Drupal\Core\Lock
View source
class NullLockBackend implements LockBackendInterface {

  /**
   * Current page lock token identifier.
   *
   * @var string
   */
  protected $lockId;

  /**
   * Implements Drupal\Core\Lock\LockBackedInterface::acquire().
   */
  public function acquire($name, $timeout = 30.0) {
    return TRUE;
  }

  /**
   * Implements Drupal\Core\Lock\LockBackedInterface::lockMayBeAvailable().
   */
  public function lockMayBeAvailable($name) {
    return TRUE;
  }

  /**
   * Implements Drupal\Core\Lock\LockBackedInterface::wait().
   */
  public function wait($name, $delay = 30) {
  }

  /**
   * Implements Drupal\Core\Lock\LockBackedInterface::release().
   */
  public function release($name) {
  }

  /**
   * Implements Drupal\Core\Lock\LockBackedInterface::releaseAll().
   */
  public function releaseAll($lock_id = NULL) {
  }

  /**
   * Implements Drupal\Core\Lock\LockBackedInterface::getLockId().
   */
  public function getLockId() {
    if (!isset($this->lockId)) {
      $this->lockId = uniqid(mt_rand(), TRUE);
    }
    return $this->lockId;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
NullLockBackend::$lockId protected property Current page lock token identifier.
NullLockBackend::acquire public function Implements Drupal\Core\Lock\LockBackedInterface::acquire(). Overrides LockBackendInterface::acquire
NullLockBackend::getLockId public function Implements Drupal\Core\Lock\LockBackedInterface::getLockId(). Overrides LockBackendInterface::getLockId
NullLockBackend::lockMayBeAvailable public function Implements Drupal\Core\Lock\LockBackedInterface::lockMayBeAvailable(). Overrides LockBackendInterface::lockMayBeAvailable
NullLockBackend::release public function Implements Drupal\Core\Lock\LockBackedInterface::release(). Overrides LockBackendInterface::release
NullLockBackend::releaseAll public function Implements Drupal\Core\Lock\LockBackedInterface::releaseAll(). Overrides LockBackendInterface::releaseAll
NullLockBackend::wait public function Implements Drupal\Core\Lock\LockBackedInterface::wait(). Overrides LockBackendInterface::wait