Releases: php-lock/lock
3.0.1
3.0.0
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
Release 2.2.1
- Support
psr/log
versions 1, 2 and 3. Thanks @athos-ribeiro and @peldax.
Release 2.2
Release 2.1
- Add the ability to get the code execution result or exception after a
LockReleaseException
. Thanks @Furgas for implementing the feature.
Release 2.0
- 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 theMemcached
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
Support for timeouts in flock calls. Uses pcntl when possible, busy waiting when not. #6.
Release 1.3
- 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 of2
. 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
- This adds a new
MySQLMutex
which usesGET_LOCK()
as a back end. - Various improvements to tests.