3 namespace Drupal\Core\Lock;
5 use Drupal\Core\Database\Connection;
8 * Defines the persistent database lock backend. This backend is global for this
13 class PersistentDatabaseLockBackend extends DatabaseLockBackend {
16 * Constructs a new PersistentDatabaseLockBackend.
18 * @param \Drupal\Core\Database\Connection $database
19 * The database connection.
21 public function __construct(Connection $database) {
22 // Do not call the parent constructor to avoid registering a shutdown
23 // function that releases all the locks at the end of a request.
24 $this->database = $database;
25 // Set the lockId to a fixed string to make the lock ID the same across
26 // multiple requests. The lock ID is used as a page token to relate all the
27 // locks set during a request to each other.
28 // @see \Drupal\Core\Lock\LockBackendInterface::getLockId()
29 $this->lockId = 'persistent';