Skip to content

v3.0.0

Latest
Compare
Choose a tag to compare
@JulianVennen JulianVennen released this 08 Apr 15:22
e4b6b84

⚠️ Breaking changes

  • PHP 8.3 is now required
  • etcd 3.3 is no longer supported
  • EtcdLock has been removed. Use Lock and Lock->lock() instead.

LockInterface

  • The Constructor of LockInterface no longer acquires the lock. Use ->lock() instead.
  • The parameters for lock, refresh and waitForOtherLocks are now properties of the lock itself (see AbstractLock).
  • LockInterface->break() and Lock->removeLock() now return void instead of always returning true
  • LockInterface->isLocked() now returns true if the lock is still valid. To get the remaining duration of the lock, use getRemainingLockDuration()

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() and Lock::setClient() have been replaced by Lock::getStorage() and Lock::setStorage(). To set an etcd client just use Lock::setClient(new EtcdStorage($client));
  • Lock->$key is no longer nullable
  • Lock->$identifier is no longer nullable, but a null value can still be passed in the constructor to use the default identifier
  • Lock->$previousLockString is now a nullable string instead of string|bool

💡 Improvements

  • Lock now implements LockInterface
  • setBreakOnDestruct, setIdentifier and update 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