title: is SETNX truly atomic?
body: <p>Redis has <a href="https://redis.io/commands/setnx" rel="nofollow noreferrer">SETNX</a> command. </p>
  
  <p>I read the documentation. However, it doesn't explicitly says whether it's atomic or not.</p>
  
  <p>I read that it's not recommended to be used for distributed locks. However, my case is a little bit simpler. All I need to make sure that whomever comes first (first caller) set the value and second caller receives an error (SETNX will return 0).</p>
  
  <p>So, the question is, is it truly atomic?</p>