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\LockCode
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;
}