HIMPORT SET
HIMPORT SET key name value [value ...]
- Group
- Hash
- Arity
- -5 (at least 5 words, counting the command name)
- HotKV Cloud
- All plans
- On-Premise
- no license needed
HIMPORT SET makes the hash at key from the values given, matched in order
with the field names that HIMPORT PREPARE stored
under name. A hash the key already held is replaced. The number of values
must equal the number of prepared fields. A key that holds another type is
refused with WRONGTYPE and left as it is.
The hash is read like any other (HGETALL, HGET).
Return value
Section titled “Return value”Simple string OK in RESP2 and RESP3. Errors:
| Error | Cause |
|---|---|
ERR no such fieldset |
name was not prepared on this connection, or was discarded. |
ERR value count does not match fieldset field count |
The number of values differs from the number of fields. |
WRONGTYPE Operation against a key holding the wrong kind of value |
The key holds another type. |
Examples
Section titled “Examples”127.0.0.1:6379> HIMPORT PREPARE person name age cityOK127.0.0.1:6379> HIMPORT SET account:1 person Ada 36 LondonOK127.0.0.1:6379> HIMPORT SET account:2 person Grace 85 NYCOK127.0.0.1:6379> HGETALL account:11) "age"2) "36"3) "city"4) "London"5) "name"6) "Ada"127.0.0.1:6379> HIMPORT SET account:3 nosuch a b c(error) ERR no such fieldset127.0.0.1:6379> HIMPORT SET account:4 person only-one(error) ERR value count does not match fieldset field count127.0.0.1:6379> SET plain xOK127.0.0.1:6379> HIMPORT SET plain person a b c(error) WRONGTYPE Operation against a key holding the wrong kind of valueCompatibility
Section titled “Compatibility”A Redis 8.10 command.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.