更新 redis扩展部分.md

This commit is contained in:
wxin 2025-03-14 19:46:26 +08:00
parent 92f73d5a89
commit 20fafa11d2

View File

@ -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
```
注意: