interface LockBackendInterface

Lock backend interface.

Hierarchy

Expanded class hierarchy of LockBackendInterface

All classes that implement LockBackendInterface

4 files declare their use of LockBackendInterface
bootstrap.inc in drupal/core/includes/bootstrap.inc
Functions that need to be loaded on every Drupal request.
RouteBuilder.php in drupal/core/lib/Drupal/Core/Routing/RouteBuilder.php
Definition of Drupal\Core\Routing\RouteBuilder.
TempStore.php in drupal/core/modules/user/lib/Drupal/user/TempStore.php
Contains Drupal\user\TempStore.
TempStoreFactory.php in drupal/core/modules/user/lib/Drupal/user/TempStoreFactory.php
Definition of Drupal\user\TempStoreFactory.

File

drupal/core/lib/Drupal/Core/Lock/LockBackendInterface.php, line 13
Definition of Drupal\Core\Lock\LockBackendInterface.

Namespace

Drupal\Core\Lock
View source
interface LockBackendInterface {

  /**
   * Acquires a lock.
   *
   * @param string $name
   *   Lock name.
   * @param float $timeout = 30.0
   *   (optional) Lock lifetime in seconds.
   *
   * @return bool
   */
  public function acquire($name, $timeout = 30.0);

  /**
   * Checks if a lock is available for acquiring.
   *
   * @param string $name
   *   Lock to acquire.
   *
   * @return bool
   */
  public function lockMayBeAvailable($name);

  /**
   * Waits a short amount of time before a second lock acquire attempt.
   *
   * While this method is subject to have a generic implementation in abstract
   * backend implementation, some backends may provide non blocking or less I/O
   * intensive wait mecanism: this is why this method remains on the backend
   * interface.
   *
   * @param string $name
   *   Lock name currently being locked.
   * @param int $delay = 30
   *   Miliseconds to wait for.
   *
   * @return bool
   *   TRUE if the wait operation was successful and lock may be available. You
   *   still need to acquire the lock manually and it may fail again.
   */
  public function wait($name, $delay = 30);

  /**
   * Releases the given lock.
   *
   * @param string $name
   */
  public function release($name);

  /**
   * Releases all locks for the given lock token identifier.
   *
   * @param string $lockId
   *   (optional) If none given, remove all locks from the current page.
   *   Defaults to NULL.
   */
  public function releaseAll($lockId = NULL);

  /**
   * Gets the unique page token for locks. Locks will be wipeout at each end of
   * page request on a token basis.
   *
   * @return string
   */
  public function getLockId();

}

Members

Namesort descending Modifiers Type Description Overrides
LockBackendInterface::acquire public function Acquires a lock. 2
LockBackendInterface::getLockId public function Gets the unique page token for locks. Locks will be wipeout at each end of page request on a token basis. 2
LockBackendInterface::lockMayBeAvailable public function Checks if a lock is available for acquiring. 2
LockBackendInterface::release public function Releases the given lock. 2
LockBackendInterface::releaseAll public function Releases all locks for the given lock token identifier. 2
LockBackendInterface::wait public function Waits a short amount of time before a second lock acquire attempt. 2