关于Redis的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. 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. 有木有大佬解释一下这句话到底是什么意思,是说当客户端获得了锁,这个命令的过期时间就不再有效了