Arguments
str
required
The key of the hash.
str
Field to set
str
Value to set
Dict[str, Any]
An object of fields and their values.
Response
The number of fields that were added.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
# Set a single field
assert redis.hset("myhash", "field1", "Hello") == 1
# Set multiple fields
assert redis.hset("myhash", values={
"field1": "Hello",
"field2": "World"
}) == 2
Write one or more fields to a hash.
# Set a single field
assert redis.hset("myhash", "field1", "Hello") == 1
# Set multiple fields
assert redis.hset("myhash", values={
"field1": "Hello",
"field2": "World"
}) == 2
Was this page helpful?