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

Breadcrumb

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

function LockFactory::createLockFromKey

Creates a lock from the given key.

Parameters

Key $key The key containing the lock's state:

float|null $ttl Maximum expected lock duration in seconds:

bool $autoRelease Whether to automatically release the lock or not when the lock instance is destroyed:

1 call to LockFactory::createLockFromKey()
LockFactory::createLock in vendor/symfony/lock/LockFactory.php
Creates a lock for the given resource.

File

vendor/symfony/lock/LockFactory.php, line 51

Class

LockFactory
Factory provides method to create locks.

Namespace

Symfony\Component\Lock

Code

public function createLockFromKey(Key $key, ?float $ttl = 300.0, bool $autoRelease = true) : SharedLockInterface {
    $lock = new Lock($key, $this->store, $ttl, $autoRelease);
    if ($this->logger) {
        $lock->setLogger($this->logger);
    }
    return $lock;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal