Hash
HSETNX
Write a field to a hash but only if the field does not exist.
Arguments
keybodystringrequired
The key of the hash.
fieldbodystringrequired
The name of the field.
valuebodyTValuerequired
Any value, if it's not a string it will be serialized to JSON.
Response
integerrequired
1 if the field was set, 0 if it already existed.
Example
await redis.hsetnx("key", "id", 1)