Hash Hash common Operation instruction
The hash keeps the mode of the KV key pair unchanged, but V is a key-value pair
Hset key field value
Set the value of the Field field in hash table key to value
Hget key Field
Gets the value of field in key
Hmset key field value [field value]
Set multiple field value key-value pairs at once
Hmget key field [field]
Gets the value of more than one field in the specified key at once
Hgetall Key
Gets all the field and corresponding values under the specified key
Hdel key field [Fiedl]
You can delete more than one field at once
Hlen Key
Gets the length of the specified key
Hexists key Field
Finds the value of a field in the specified hash table
Hkeys Key
View all field in a given hash table
Hvals Key
View all values in a given hash table
Hincrby key Field Step
Adds a step (integer) to the given value, defines a hash structure, and the key is the customer field, including the Age name address
You can see that the age has changed from 24 to 25.
Hincrbyfloat key Field Step
Adds a floating-point number to a given value
Give age plus 0.5, you can see the result becomes 25.5
Hsetnx key field value
If there is no corresponding field in the given key, a new key value pair is added to enter
Because the previous hash table already exists in the age, so the setup failed, no email, we set the email success