更新 redis扩展部分.md
This commit is contained in:
parent
92f73d5a89
commit
20fafa11d2
@ -29,13 +29,18 @@ Zookeeper:也是企业级开发中较好的一个实现分布式锁的方案
|
||||
### 4. 设置分布式锁
|
||||
|
||||
```bash
|
||||
|
||||
[root@redis ~]# redis-cli
|
||||
127.0.0.1:6379> set name zhangsan NX EX 10
|
||||
# 添加锁 NX是互斥的 EX设置超时时间
|
||||
127.0.0.1:6379> setnx class cloud
|
||||
# 使用SETNX创建互斥锁
|
||||
```
|
||||
|
||||
删除:
|
||||
|
||||
```bash
|
||||
|
||||
[root@redis ~]# redis-cli
|
||||
127.0.0.1:6379> del key
|
||||
```
|
||||
|
||||
注意:
|
||||
|
Loading…
x
Reference in New Issue
Block a user