Releases: aternosorg/php-lock
Releases · aternosorg/php-lock
v3.0.0
⚠️ 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
v2.1.0
v2.0.0
v1.2.0
What's Changed
- Update license year and rename Aternos UG to Aternos GmbH by @pavog in #1
- Update phpunit to 9.5.20
- Updated aternos/etcd to 1.5.0
- Add namespace to test by @pavog in #3
- Improve tests by @pavog in #4
- Improve test coverage for lock functions by @pavog in #5
New Contributors
Full Changelog: v1.1.2...v1.2.0
v1.2.0-RC2
set return type for jsonSerialize()
v1.2.0-RC1
What's Changed
- Updated
aternos/etcdto 1.5.0-RC1 andgoogle/protobufto 3.20.0-RC2 - Update license year and rename Aternos UG to Aternos GmbH by @pavog in #1
- Update phpunit to 9.5.19 by @pavog in #2
- Add namespace to test by @pavog in #3
- Improve tests by @pavog in #4
New Contributors
Full Changelog: v1.1.2...v1.2.0-RC1
v1.1.2
v1.1.1
v1.1.0
This release requires at least PHP 8.0.
This is a general refactor cleaning up the code a bit and moving the locking logic from the EtcdLock to the Lock class which doesn't acquire a lock in its constructor. The previous EtcdLock class still exists and works the same as before by extending the Lock class. The new Lock class allows creating a $lock object to read existing locks without immediately acquiring one.