HSET
Syntax
HSET key field value [field value ...]
- Available since:
- 2.0.0
- Time complexity:
- O(1) for each field/value pair added, so O(N) to add N field/value pairs when the command is called with multiple field/value pairs.
- ACL categories:
-
@write
,@hash
,@fast
,
Sets field
in the hash stored at key
to value
.
If key
does not exist, a new key holding a hash is created.
If field
already exists in the hash, it is overwritten.
Return
Integer reply: The number of fields that were added.
Examples
History
- Starting with Redis version 4.0.0: Accepts multiple
field
andvalue
arguments.
Feedback
If you've found issues on this page, or have suggestions for improvement, please submit a request to merge or open an issue in the repository.