Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pastuhov/yii2-redis-mutex
Yii2 Redis mutex
https://github.com/pastuhov/yii2-redis-mutex
cache mutex redis
Last synced: 3 months ago
JSON representation
Yii2 Redis mutex
- Host: GitHub
- URL: https://github.com/pastuhov/yii2-redis-mutex
- Owner: pastuhov
- License: gpl-3.0
- Created: 2016-01-18T12:18:33.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2020-01-31T13:53:29.000Z (almost 5 years ago)
- Last Synced: 2024-10-04T18:50:40.102Z (3 months ago)
- Topics: cache, mutex, redis
- Language: PHP
- Homepage:
- Size: 28.3 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Yii2 redis mutex
[![Build Status](https://travis-ci.org/pastuhov/yii2-redis-mutex.svg)](https://travis-ci.org/pastuhov/yii2-redis-mutex)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/pastuhov/yii2-redis-mutex/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/pastuhov/yii2-redis-mutex/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/pastuhov/yii2-redis-mutex/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/pastuhov/yii2-redis-mutex/?branch=master)
[![Total Downloads](https://poser.pugx.org/pastuhov/yii2-redis-mutex/downloads)](https://packagist.org/packages/pastuhov/yii2-redis-mutex)## Install
Via Composer
``` bash
$ composer require pastuhov/yii2-redis-mutex
```## Features
* Deadlock free
* Robust## Disadvantages
* no spinlock
* non distributed## Usage
```php
$mutex = \Yii::createObject([
'class' => \pastuhov\yii2redismutex\RedisMutex::className(),
'redis' => $redisConnection
]);$mutexName = 'lock';
if ($mutex->acquire($mutexName)) {
$value++;
$mutex->release($mutexName);
}
```## Testing
```bash
$ composer test
```
or
```bash
$ phpunit
```## Debugging
For debugging purposes use:
```bash
$ redis-cli monitor
```
or```bash
$ tail -f tests/runtime/logs/app.log -n 1000
```## Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
## Credits
- [Kirill Pastukhov](https://github.com/pastuhov)
- [All Contributors](../../contributors)## License
GNU General Public License, version 2. Please see [License File](LICENSE) for more information.