Single Instance Lock based Redis
- Use the composer command or the composer.json file. That's the recommend way. And the SDK is here
wudege/sil
$ composer require wudege/sil
require __DIR__ . '/../vendor/autoload.php';
$config = array(
'host' => '127.0.0.1',
'port' => 6379,
'database' => 5,
);
$client = new \Predis\Client($config);
$lock = new \Sil\RedisSingleInstanceLock($client);
$lock->acquireLock('lock-example', sha1(uniqid(mt_rand(), true)), 3000);
$ ./vendor/bin/phpunit tests/Sil/Tests
The MIT License (MIT). License File.