Skip to main content
await redis.hsetnx("key", "id", 1)

Arguments

key
string
required
The key of the hash.
field
string
required
The name of the field.
value
TValue
required
Any 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)