-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Labels
Description
Description
LockFactory returns SharedLocksInterface's
symfony/src/Symfony/Component/Lock/LockFactory.php
Lines 44 to 47 in 98e0fa4
public function createLock(string $resource, ?float $ttl = 300.0, bool $autoRelease = true): LockInterface | |
{ | |
return $this->createLockFromKey(new Key($resource), $ttl, $autoRelease); | |
} |
symfony/src/Symfony/Component/Lock/LockFactory.php
Lines 56 to 62 in 98e0fa4
public function createLockFromKey(Key $key, ?float $ttl = 300.0, bool $autoRelease = true): LockInterface | |
{ | |
$lock = new Lock($key, $this->store, $ttl, $autoRelease); | |
$lock->setLogger($this->logger); | |
return $lock; | |
} |
final class Lock implements SharedLockInterface, LoggerAwareInterface |
Should we update the return types?
Also acquireRead()
may forward to acquire()
symfony/src/Symfony/Component/Lock/Lock.php
Lines 136 to 144 in 98e0fa4
public function acquireRead(bool $blocking = false): bool | |
{ | |
$this->key->resetLifetime(); | |
try { | |
if (!$this->store instanceof SharedLockStoreInterface) { | |
$this->logger->debug('Store does not support ReadLocks, fallback to WriteLock.', ['resource' => $this->key]); | |
return $this->acquire($blocking); | |
} |
which raises questions about this contract in the first place ... :) perhaps an @method
on LockInterface
is possible still?
Example
No response