⚠️ Breaking changes
- PHP 8.3 is now required
- etcd 3.3 is no longer supported
EtcdLock
has been removed. UseLock
andLock->lock()
instead.
LockInterface
- The Constructor of
LockInterface
no longer acquires the lock. Use->lock()
instead. - The parameters for
lock
,refresh
andwaitForOtherLocks
are 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.5
by 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->$key
is no longer nullableLock->$identifier
is no longer nullable, but a null value can still be passed in the constructor to use the default identifierLock->$previousLockString
is now a nullable string instead ofstring|bool
💡 Improvements
Lock
now implementsLockInterface
setBreakOnDestruct
,setIdentifier
andupdate
now return the lock instance ($this
)break()
no longer performs unnecessary requests if the lock is not present- Added
Lock->getKey()
- Added
getRemainingLockDuration
which 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