Via Composer
$ composer require pastuhov/yii2-redis-mutex
- Deadlock free
- Robust
- no spinlock
- non distributed
$mutex = \Yii::createObject([
'class' => \pastuhov\yii2redismutex\RedisMutex::className(),
'redis' => $redisConnection
]);
$mutexName = 'lock';
if ($mutex->acquire($mutexName)) {
$value++;
$mutex->release($mutexName);
}
$ composer test
or
$ phpunit
For debugging purposes use:
$ redis-cli monitor
or
$ tail -f tests/runtime/logs/app.log -n 1000
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
GNU General Public License, version 2. Please see License File for more information.