SETNX
RU: SETNX
A Redis command (SET if Not eXists) that writes a key only when it is absent, returning 1 on success and 0 if the key already existed. It is the atomic primitive behind Redis-based distributed locks; modern code uses SET key value NX EX seconds to combine the check and TTL in one atomic operation.