Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. NullLockBackend.php

class 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

Locking mechanisms
Functions to coordinate long operations across requests.
1 file declares its use of NullLockBackend
NormalInstallerServiceProvider.php in core/lib/Drupal/Core/Installer/NormalInstallerServiceProvider.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((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 Acquires a lock. Overrides LockBackendInterface::acquire
NullLockBackend::getLockId public function Gets the unique page token for locks. Overrides LockBackendInterface::getLockId
NullLockBackend::lockMayBeAvailable public function Checks if a lock is available for acquiring. Overrides LockBackendInterface::lockMayBeAvailable
NullLockBackend::release public function Releases the given lock. Overrides LockBackendInterface::release
NullLockBackend::releaseAll public function Releases all locks for the given lock token identifier. Overrides LockBackendInterface::releaseAll
NullLockBackend::wait public function Waits a short amount of time before a second lock acquire attempt. Overrides LockBackendInterface::wait
RSS feed
Powered by Drupal