写锁WriteLock
和读锁一样,在这个地方执行自己的lua脚本,我们去看一下
和read没有多大的区别
KEYS[1] = anyLock
ARGV[1] = 30000
ARGV[2] = UUID_01:threadId_01:write
hget anyLock mode,此时肯定是没有的,因为根本没这个锁
hset anyLock mode write
hset anyLock UUID_01:threadId_01:write 1
pexpire anyLock 30000
anyLock: {
“mode”: “write”,
“UUID_01:threadId_01:write”: 1
}
加写锁就已经成功了
看门狗逻辑用的是默认的RedissonLock中的逻辑,如果有名为 anyLock的hash并且里面有UUID_01:threadId_01:write这个key,就延长这个锁。