Common usage of Redis hash (Hash)

1 Syntax: Hset table filed value, HDEL key field2 [field2]
Set a value, delete one or more hash table fields (remarks, only one field, cannot set multiple fields, as shown in Figure 2)






2 Syntax: HEXISTS key field
Check whether the specified field exists in the hash table key.





3 Syntax: HGET key field, set a field, hmset, hmget set multiple fields respectively, take multiple keys,
get the value of the specified field stored in the hash table. You can refer to the above list, but you can only get the field corresponding to one field at a time, as shown in the figure below:





4 Syntax: HGETALL key
to get all fields and values ​​of the specified key in the hash table







5 Syntax: HINCRBY key field increment
is the hash table key Integer value of the specified field in plus increment. (Note, only numeric types can be added)






6 Syntax: HKEYS key
to get all fields in the hash table




7 Syntax: Hvals key
to get the value corresponding to all fields in the hash table






8 Syntax: HLEN key
to get the hash table Number of fields in







9 Syntax: HMGET key field1 [field2]
Get the value of all given fields






12 Syntax: HSETNX key field value
Set the value of the hash table field only if the field field does not exist.







Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326391466&siteId=291194637