SetnxCommand: Contents
  SETNX _key_ _value_
    Return value
    See also

SetnxCommand

SETNX _key_ _value_

Time complexity: O(1)
SETNX works exactly like SET with the only difference thatif the key already exists no operation is performed.SETNX actually means "SET if Not eXists".

Return value

Integer reply, specifically:

1 if the key was set
0 if the key was not set

See also