Skip to main content

Arguments

key
str
required
The key of the hash.
field
str
Field to set
value
str
Value to set
values
Dict[str, Any]
An object of fields and their values.

Response

The number of fields that were added.
# Set a single field
assert redis.hset("myhash", "field1", "Hello") == 1
# Set multiple fields
assert redis.hset("myhash", values={
  "field1": "Hello",
  "field2": "World"
}) == 2