2017 © Pedro Peláez
 

yii2-extension yii2-redlock

Class for easier Redlock integration

image

msheng/yii2-redlock

Class for easier Redlock integration

  • Tuesday, August 9, 2016
  • by msheng
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

yii2-redlock

A redlock for Yii2, distributed locks with Redis, (*1)

Based on Redlock-rb by Salvatore Sanfilippo and signe redlock-php, (*2)

Installation

To install run:, (*3)

    composer require "msheng/yii2-redlock:~1.0.0"

Or add this line to require section of composer.json:, (*4)

    "msheng/yii2-redlock": "~1.0.0"

project

Your project need to be an yii2-app-advanced , and here is the guide, (*5)

main.php

In common/config/main.php or main-local.php, (*6)

<?php
'components' => [
    'redLock' => [
        'class' => 'msheng\RedLock\RedLock',
        'servers' => [
            [
                'hostname' => '127.0.0.1',
                'port' => 6379,
                'timeout' => 0.5,
            ],
            [
                'hostname' => '127.0.0.1',
                'port' => 6389,
                'timeout' => 0.05,
            ],
            [
                'hostname' => '127.0.0.1',
                'port' => 6399,
                'timeout' => 0.05,
            ]
        ]
    ]
],

Usage

<?php
$lock = Yii::$app->redLock->lock('hello');
if($lock){
    sleep(10);
    Yii::$app->redLock->unlock($lock);
}

The Versions

09/08 2016

dev-develop

dev-develop https://github.com/Yemsheng/yii2-redlock

Class for easier Redlock integration

  Sources   Download

MIT

The Requires

 

php yii2 redis redlock

09/08 2016

dev-master

9999999-dev https://github.com/Yemsheng/yii2-redlock

Class for easier Redlock integration

  Sources   Download

MIT

The Requires

 

yii2 redis redlock

09/08 2016

1.0.1

1.0.1.0 https://github.com/Yemsheng/yii2-redlock

Class for easier Redlock integration

  Sources   Download

MIT

The Requires

 

yii2 redis redlock

08/08 2016

1.0.0

1.0.0.0 https://github.com/Yemsheng/yii2-redlock

Class for easier Redlock integration

  Sources   Download

MIT

The Requires

 

yii2 redis redlock