Skip to content

Commit

Permalink
lua设置过期时间统一成秒级时间戳 (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhpengsong authored Nov 18, 2022
1 parent 6f73e3b commit 44153c3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion script/lua/lock.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local val = redis.call('get', KEYS[1])
-- 在加锁的重试的时候,要判断自己上一次是不是加锁成功了
if val == false then
-- key 不存在
return redis.call('set', KEYS[1], ARGV[1], 'PX', ARGV[2])
return redis.call('set', KEYS[1], ARGV[1], 'EX', ARGV[2])
elseif val == ARGV[1] then
-- 刷新过期时间
redis.call('expire', KEYS[1], ARGV[2])
Expand Down

0 comments on commit 44153c3

Please sign in to comment.