哈希表
Hashes are maps between string fields and string values, so they are the perfect data type to represent objects (eg: A User with a number of fields like name, surname, age, and so forth):
一、HSET
二、HGET
三、HGETALL
> hset jimliang age 20 (integer) 1 > hset jimliang experience 4year (integer) 1 > hset jimliang email jimzyliang@wula.com (integer) 1 > hgetall jimliang 1) "age" 2) "20" 3) "experience" 4) "4year" 5) "email" 6) "jimzyliang@wula.com"
四、HINCRBY
五、HDEL
> hincrby jimliang age 5 //自增5个,是原子操作哦,即更改时会锁定 (integer) 25 > hget jimliang age "25" > hdel jimliang age //删除 哈希表jimliang中的 age 属性 (integer) 1 > hget jimliang age (nil)