关于Redis的SETNX 实现的分布式锁问题

Pisces_Aries Pisces_Aries 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
If SETNX returns 1 the client acquired the lock, setting the lock.foo key to the Unix time at which the lock should no longer be considered valid. The client will later use DEL lock.foo in order to release the lock.

If SETNX returns 0 the key is already locked by some other client. We can either return to the caller if it's a non blocking lock, or enter a loop retrying to hold the lock until we succeed or some kind of timeout expires.

redis.io 关于setnx 有这么一段 描述, 其中他说 If SETNX returns 1 the client acquired the lock, setting the lock.foo key to the Unix time at which the lock should no longer be considered valid. 有木有大佬解释一下这句话到底是什么意思,是说当客户端获得了锁,这个命令的过期时间就不再有效了
...全文

相关推荐

评论 2
收藏 已收藏
分享
返回顶部
Pisces_Aries
数据库相关 2,508 成员 88,437 内容