Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
redlock
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘旋尧
redlock
Commits
7730f255
Commit
7730f255
authored
Aug 21, 2018
by
刘旋尧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update README.md
parent
e872786e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
README.md
README.md
+29
-0
No files found.
README.md
View file @
7730f255
# redlock
一款基于redis的分布式锁,可以用于解决高并发情况下重复写的情况,比如网络卡的情况下,
用户发表动态,疯狂点击发表按钮,导致请求几乎同时到达服务端,最终导致同样的动态重复发表多次。
# 使用方法
1.
安装
```
shell
composer require usual2970/redlock
```
2.
使用
```
php
use
usual2970
/
redlock
;
$lock
=
new
redlock\Lock
(
'tcp://redis-address'
);
$key
=
get_your_key
();
$lock
->
lock
(
$key
);
//你的业务代码
$lock
->
unLock
(
$key
);
```
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment