⚠️ Breaking changes
- PHP 8.3 is now required
- etcd 3.3 is no longer supported
EtcdLockhas been removed. UseLockandLock->lock()instead.
LockInterface
- The Constructor of
LockInterfaceno longer acquires the lock. Use->lock()instead. - The parameters for
lock,refreshandwaitForOtherLocksare now properties of the lock itself (seeAbstractLock). LockInterface->break()andLock->removeLock()now return void instead of always returning trueLockInterface->isLocked()now returns true if the lock is still valid. To get the remaining duration of the lock, usegetRemainingLockDuration()
Lock
- The refresh threshold is now relative to the refresh time (
0.5by default). - The refresh time is now the same as the lock time by default.
Lock->getClient()andLock::setClient()have been replaced byLock::getStorage()andLock::setStorage(). To set an etcd client just useLock::setClient(new EtcdStorage($client));Lock->$keyis no longer nullableLock->$identifieris no longer nullable, but a null value can still be passed in the constructor to use the default identifierLock->$previousLockStringis now a nullable string instead ofstring|bool
💡 Improvements
Locknow implementsLockInterfacesetBreakOnDestruct,setIdentifierandupdatenow return the lock instance ($this)break()no longer performs unnecessary requests if the lock is not present- Added
Lock->getKey() - Added
getRemainingLockDurationwhich returns the remaining duration a lock is valid for. - Added StorageInterface to allow implementing other kinds of storage without having to reimplement the entire lock
- Added SimpleInMemoryStorage for unit testing applications that make use of this library
Full Changelog: v2.1.0...v3.0.0