HSET

Since 1.1.0Hashes

Syntax

HSET key field value [field value ...]
  • Flags: fast, write
  • ACL categories: @fast, @hash, @write
  • Arity: -4

Sets fields of the hash at key, each to its value. A missing key is created. Setting a field that has an expiry removes the expiry.

Reply

  • The number of fields added; fields that already existed and were updated are not counted.
  • A WRONGTYPE error if the key is not a hash.

Examples

> HSET u name Ada lang Rust
(integer) 2
> HSET u name Grace
(integer) 0
> HGET u name
"Grace"