function Drupal::lock

Same name and namespace in other branches
  1. 11.x core/lib/Drupal.php \Drupal::lock()
  2. 10 core/lib/Drupal.php \Drupal::lock()
  3. 9 core/lib/Drupal.php \Drupal::lock()
  4. 8.9.x core/lib/Drupal.php \Drupal::lock()

Returns the locking layer instance.

Return value

\Drupal\Core\Lock\LockBackendInterface The locking layer instance.

Related topics

4 calls to Drupal::lock()
DrupalTest::testLock in core/tests/Drupal/Tests/Core/DrupalTest.php
Tests the lock() method.
PerformanceDataCollector::destruct in core/modules/system/tests/modules/performance_test/src/PerformanceDataCollector.php
Performs destruct operations.
RegistryTest::testRaceCondition in core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php
Tests the behavior of the theme registry class.
TestHttpClientMiddleware::__invoke in core/lib/Drupal/Core/Test/HttpClientMiddleware/TestHttpClientMiddleware.php
HTTP middleware that replaces the user agent for test requests.

File

core/lib/Drupal.php, line 402

Class

Drupal
Static Service Container wrapper.

Code

public static function lock() {
  return static::getContainer()->get('lock');
}

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