PHP code example of cxr / laravel-redislock
1. Go to this page and download the library: Download cxr/laravel-redislock 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/ */
cxr / laravel-redislock example snippets
DistributedLock::lock('key', 3); //上锁3s,可指定连接串,默认default
DistributedLock::unlock('key'); //解锁,可指定连接串,默认default