Skip to content

Releases: aternosorg/php-lock

v3.0.0

08 Apr 15:22
e4b6b84

Choose a tag to compare

⚠️ 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

v2.1.0

14 Jan 12:44
74a0d02

Choose a tag to compare

What's Changed

  • add option to set identifier in construct and with function by @matthi4s in #10

Full Changelog: v2.0.0...v2.1.0

v2.0.0

13 Dec 13:49
afcded8

Choose a tag to compare

⚠️ v2.0.0 requires PHP >= 8.1

What's Changed

  • Update to use PHP 8.1 by @pavog in #8
  • Update to use phpunit 10.5 by @pavog in #8
  • PHP 8.4 compatability: Make parameter types explicitly nullable by @pavog in #9
  • Update year in LICENSE by @pavog in #7 and #6

Full Changelog: v1.2.0...v2.0.0

v1.2.0

07 Jun 11:52
d963154

Choose a tag to compare

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

  • @pavog made their first contribution in #1

Full Changelog: v1.1.2...v1.2.0

v1.2.0-RC2

24 Mar 13:51
5034c0a

Choose a tag to compare

v1.2.0-RC2 Pre-release
Pre-release
set return type for jsonSerialize()

v1.2.0-RC1

24 Mar 13:45
36ff431

Choose a tag to compare

v1.2.0-RC1 Pre-release
Pre-release

What's Changed

  • Updated aternos/etcd to 1.5.0-RC1 and google/protobuf to 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

  • @pavog made their first contribution in #1

Full Changelog: v1.1.2...v1.2.0-RC1

v1.1.2

17 Nov 13:10

Choose a tag to compare

allow null identifiers

v1.1.1

12 Nov 16:47

Choose a tag to compare

separated wait logic into public function

v1.1.0

12 Nov 16:31

Choose a tag to compare

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.

v1.0.4

05 May 22:04

Choose a tag to compare

add getter for identifier and allow disabling of auto lock break on d…