Hash
HSETNX
Write a field to a hash but only if the field does not exist.
await redis.hsetnx("key", "id": 1)
Arguments
key
string
requiredThe key of the hash.
field
string
requiredThe name of the field.
value
TValue
requiredAny value, if it’s not a string it will be serialized to JSON.
Response
1
if the field was set, 0
if it already existed.
await redis.hsetnx("key", "id": 1)