Skip to content

3.0.0

Compare
Choose a tag to compare
@mvorisek mvorisek released this 15 Dec 14:52
· 1 commit to master since this release

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