1. introduction to hash expression: ========================================================== ==== key field value =========================================== ========== front wheel ---> Foxconn rear wheel ---> Apple BMW: windscreen ---> jiadobao seat ---> Wang laoji steering wheel ---> Evergrande ice spring ==================== ======================== the hash type better applies to the same object, different attributes correspond to different values; for example, you cannot use the string type to achieve this result ================================== ==================== BMW: front Wheel ---> Foxconn BMW: Rear Wheel ---> Apple BMW: windshield ---> gabo BMW: Seat ---> Wang laoji BMW: steering wheel ---> Evergrande ice spring ======================================== ==========In this way, it is easy to cause unnecessary space waste and unnecessary increase of keys. assign hset to BMW front-wheel Foxconn 3. value: hget BMW front wheel. 3. batch assignment hmset BMW front wheel Foxconn rear wheel Apple 4. batch value: 5. obtain all the key value information hgetall6. determine whether the field exists hexists. If the front wheel of BMW, 1 is returned, and 07 is returned if no key value exists. determine whether the field exists. If it does not exist, assign a value to the hsetnx BMW seat Wang laoji. If "Seat" already exists, do not perform the operation. If "Seat" does not exist, set "Seat ", set the value of "Seat" to "Wang laoji" 8. add a number (if the number is reduced, set it to a negative number) hset BMW wheel count 3 // set the number of BMW wheels to 3 hincrby BMW wheel count 1 // Add one to the wheel, (The command will directly return the result after adding) 9. if the number of hdel BMW wheels is not needed that day, you can use hdel to delete it ====================================== ============= PS:: it can be seen that the hash type of redis is particularly useful for storing data with one-to-many relationships, because it means that you do not need to use strings to store these relationships, which greatly saves space and application complexity; ========================================================== ========