Redis Hash: HMSET
HMSET key field1 value1 [field2 value2 ]
Redis HMSET command is used to set the specified fields to their respective values in the hash stored at key. This command overwrites any existing fields in the hash. If the key does not exist, a new key holding a hash is created.
Syntax:
HMSET KEY_NAME FIELD1 VALUE1 ...FIELDN VALUEN
Available since
2.0.0.
Return Value
Simple string reply
Note: Simple Strings are encoded in the following way: a plus character, followed by a string that cannot contain a CR or LF character (no newlines are allowed), terminated by CRLF (that is "\r\n").
Return Value Type
Integer
Example: Redis HMSET
127.0.0.1:6379> HMSET langhash lang1 "PHP" lang2 "JavaScript" lang3 "Redis" OK 127.0.0.1:6379> HGET langhash lang1 "PHP" 127.0.0.1:6379> HGET langhash lang2 "JavaScript" 127.0.0.1:6379> HGET langhash lang3 "Redis"
Example: Redis HMSET another example
127.0.0.1:6379> HMSET user-y email [email protected] language English gender Male OK 127.0.0.1:6379> HGETALL user-y 1) "email" 2) "[email protected]" 3) "language" 4) "English" 5) "gender" 6) "Male"
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics