Redis hash field is a string type and the value of the mapping table, hash is particularly suited for storing objects.
Each hash may be stored Redis 232--1 key-value pair (40 billion).
Examples
127.0.0.1:6379> HMSET coderctokey name "redis tutorial" description "redis basic commands for caching" likes 20 visitors 23000
OK
127.0.0.1:6379> HGETALL coderctokey
1) "name"
2) "redis tutorial"
3) "description"
4) "redis basic commands for caching"
5) "likes"
6) "20"
7) "visitors"
8) "23000"
In the above example, we set the coderctokey redis some descriptive information (name, description, likes, visitors) to the hash table.
Redis hash command
The following table lists the basic redis hash related commands:
Number and description of command
1HDEL key field1 [field2]
Remove one or more hash table field
2HEXISTS key field
View the hash table key, the specified field is present.
3HGET key field
Gets the value of the specified field stored in the hash table.
4HGETALL key
Get all the specified key fields and values in the hash table
5HINCRBY key field increment
An integer value of the specified field in the hash table key plus delta increment.
6HINCRBYFLOAT key field increment
Floating point values specified field hash table key plus the delta increment.
7HKEYS key
Get all the fields in the hash table
8HLEN key
Gets the number of fields in the hash table
9HMGET key field1 [field2]
Gets the value of all the given field
10HMSET key field1 value1 [field2 value2 ]
While the plurality of field-value (Domain - value) provided to the key in the hash table.
11HSET key field value
The value of the hash table key field field is set to value.
12HSETNX key field value
Only when there is no field field, set the value of the hash table field.
13HVALS key
Gets all the values in the hash table
14HSCAN key cursor [MATCH pattern] [COUNT count]
Iterative hash table pairs.
More commands, refer to: https: //redis.io/commands (edit: Leilin Peng Source: network intrusion deleted)