pastuhov / yii2-redis-mutex
Yii2 Redis mutex.
Installs: 19 113
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 1
Forks: 1
Open Issues: 0
Type:yii2-extension
Requires
- php: >=5.3.0
- yiisoft/yii2: ~2.0.0
- yiisoft/yii2-redis: ~2.0.0
Requires (Dev)
- phpunit/phpunit: 4.*
- scrutinizer/ocular: ~1.1
This package is not auto-updated.
Last update: 2024-11-16 12:20:11 UTC
README
Install
Via Composer
$ composer require pastuhov/yii2-redis-mutex
Features
- Deadlock free
- Robust
Disadvantages
- no spinlock
- non distributed
Usage
$mutex = \Yii::createObject([ 'class' => \pastuhov\yii2redismutex\RedisMutex::className(), 'redis' => $redisConnection ]); $mutexName = 'lock'; if ($mutex->acquire($mutexName)) { $value++; $mutex->release($mutexName); }
Testing
$ composer test
or
$ phpunit
Debugging
For debugging purposes use:
$ redis-cli monitor
or
$ tail -f tests/runtime/logs/app.log -n 1000
Security
If you discover any security related issues, please email kirill@pastukhov.su instead of using the issue tracker.
Credits
License
GNU General Public License, version 2. Please see License File for more information.