Skip to content

based on lua script redis lock for webman plugin

Notifications You must be signed in to change notification settings

Tinywan/webman-lock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

based on lua script redis lock for webman plugin

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

安装

composer require tinywan/webman-lock

使用

// 锁名称
$lockName = md5((string) time());
// 锁标识
$lockId = \Tinywan\Lock\RedisLock::acquire($lockName);
if (!$lockId) {
    return '未获得锁标识,请稍后再试';
}

// 业务处理

// 释放锁
\Tinywan\Lock\RedisLock::release($lockName, $lockId);