PHP code example of toanppp / php-redis-lock

1. Go to this page and download the library: Download toanppp/php-redis-lock library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

toanppp / php-redis-lock example snippets


$redisLockInstance = RedisLock::getInstance('127.0.0.1', 6379);

$redisLockInstance->acquire('key');

$redisLockInstance->release('key');

$type = 'uniqueKey';
$redisLockInstance->acquire(uniqid(), $type);

$redisLockInstance->releaseByType($type);
shell
composer