X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/76d31044d44c7adb4af71dd273b52ec9a4768e17..49128f0b9da725de992e427fa341a837bcc2991b:/doc/SetnxCommand.html diff --git a/doc/SetnxCommand.html b/doc/SetnxCommand.html index 91f9206d..8c47e72d 100644 --- a/doc/SetnxCommand.html +++ b/doc/SetnxCommand.html @@ -41,6 +41,7 @@ SETNX lock.foo <current UNIX time + lock timeout + 1>
Fortunately it's possible to avoid this issue using the following algorithm.Let's see how C4, our sane client, uses the good algorithm:
+IMPORTANT NOTE: In order to make this locking algorithm more robust, a client holding a lock should always check the timeout didn't expired before to unlock the key with DEL because client failures can be complex, not just crashing but also blocking a lot of time against some operation and trying to issue DEL after a lot of time (when the LOCK is already hold by some other client).