HMSET command in redis

HMSET key field value [field value ...]

Sets the specified fields to their respective values in the hash stored at key. This command overwrites any existing fields in the hash.

Note: If the key does not exist, a new key holding a hash is created.

TIME COMPLEXITY O(N) where N is the number of fields being set.

RETURN VALUE: It returns the status code.

Syntax:

HMSET KEY_NAME FIELD_NAME VALUE FIELD_NAME2 VALUE .. FIELD_NAMEN VALUE

Example

redis:6379> HMSET myhash field 100 field1 200 field2 300
"OK"

Output

OK

No comments:

Post a Comment