Skip to content

Releases: php-lock/lock

3.0.1

17 Dec 01:44
1dcf32d
Compare
Choose a tag to compare

Other changes

  • Add PHP 8.4 support (#58)

Full changelog: 3.0.0...3.0.1

3.0.0

15 Dec 14:52
Compare
Choose a tag to compare

Major features - renamed namespace

  • Rename namespace to PascalCase (#65)

Rename all FQCN uses from camelCase to PascalCase like malkusch\lock\mutex\Mutex to Malkusch\Lock\Mutex\Mutex.

Major features - renamed namespace

  • Merge Redis mutex implementations into single RedisMutex class (#69)
  • Introduce DistributedMutex class (#75)

In 2.x version, there were two PHPRedisMutex and PredisMutex classes. They were almost a duplicate of each other and both have implemented RedLock distributed lock when more than 1 Redis client instance was passed to the constructor.

Newly, in 3.x version, both class were unified into one RedisMutex class supporting both PHP redis and Predis clients. In addition, the constructor newly accepts only single Redis client instance.

When distributed lock is wanted, use new DistributedMutex class which newly accepts any AbstractSpinlockMutex class which is currently implemented by RedisMutex and MemcachedMutex. This change allows you to create distributed lock across different backends.

Major features - other

  • Introduce AbstractSpinlockWithTokenMutex class (#72)
  • Add fail callback support in DoubleCheckedLocking::then() method (#76)

Newly we strictly distinguish between:
- "acquire timeout" (timeout before the library give up trying to acquire a lock for your code)
- and "expire timeout" (timeout after the lock expires on the, possibly remote, store).

Breaking changes

  • Unify lock/unlock methods visibility (#62)
  • Prefix MySQL and PostgreSQL mutex name (#63, #64)
  • Remove CASMutex class (#67)
  • Improve abstract mutex classes naming (#68)
  • Rename TimeoutException to LockAcquireTimeoutException (#70)
  • Remove TransactionalMutex class (#73)
  • Rename NoMutex class to NullMutex (#74)

Other changes

  • Internal LockUtil class was added to deduplicate the code (70fd6d9)
  • Fix float to int casting and improve timeout names (#71)
  • Improve distributed locking (#77)
  • Fix pcntl_signal() restore when pcntl_alarm() is set (4fe9681)

Full changelog: 2.3.0...3.0.0

2.3.0

05 Dec 23:15
Compare
Choose a tag to compare

Major features

  • Add support for fractional seconds timeout (#55)

Other changes

  • Drop PHP 7.2 and PHP 7.3 support (b10b0a0)
  • Emit exceptions without "." at the end (515250e)
  • Improve RedisMutex token randomness (a98afa2)

Full changelog: 2.2.1...2.3.0

Release 2.2.1

26 Apr 09:59
63c1b26
Compare
Choose a tag to compare

Release 2.2

07 Mar 19:51
c3ee9d7
Compare
Choose a tag to compare
  • Support LZF compression on Redis connections (#32)
  • Redlock token is now in hexadecimal for easier debugging (#41)
  • Various changes such as adding phpstan, upgrading to a more recent version of PHPUnit, adding PHPCS etc.
  • Add PHP 8.0 support (#45)

Thanks everyone who contributed: @mvorisek and @TheLevti.

Release 2.1

12 Dec 19:59
093f389
Compare
Choose a tag to compare
  • Add the ability to get the code execution result or exception after a LockReleaseException. Thanks @Furgas for implementing the feature.

Release 2.0

08 Nov 21:43
5078c36
Compare
Choose a tag to compare
  • PHP >= 7.1 only release. Thanks @TheLevti for assisting.
  • This version adds type hints to arguments and return types to methods. If you have your own implementations of the Mutex class, you might need to update it slightly.
  • The Memcache Mutex has been removed. You should use the Memcached mutex instead.
  • The Predis and PHPRedis mutexes have been updated to better follow the distlock from the Redis documentation.
  • A bug has been fixed in the Predis mutex where failing to release a lock could cause a fatal error if sentinel replication was used.
  • The return value of the callable passed to then() is now returned (#23). Thanks @TheLevti.
  • Various testing and CI improvements.

Release 1.4

07 Jul 18:49
Compare
Choose a tag to compare

Support for timeouts in flock calls. Uses pcntl when possible, busy waiting when not. #6.

Release 1.3

26 May 11:49
Compare
Choose a tag to compare
  • Adds a new lock backend based on PostgreSQL's advisory locks. Thanks to @korotovsky for suggesting this feature.
  • Spinlocks now use a back off factor of 1.5 instead of 2. This means that released locks will be detected earlier at the cost of performing more checks. This affects the various Redis and Memcached based lock backends.
  • Various testing and CI improvements.

Release 1.2

22 May 06:25
Compare
Choose a tag to compare
  • This adds a new MySQLMutex which uses GET_LOCK() as a back end.
  • Various improvements to tests.