1>hset setname field value hset stuset name zhangsan:1 2>hget setname field Hge T stuset name:nil hget stuset Name:zhangsan (indicates Redis is case-sensitive) 3>hsetnx setname field value If field exists, do nothing. If not, create hsetnx stuset name lisi:0 hsetnx stuset name lisi1:1 hget stuset name:zhangsan hget stuset NAME1:LISI 4&G T;hmset setname field1value1 field2 value2 ... hmset stuset namea a nameb b:ok hmset stuset Namea a nameb b Namec C:ok (thus See, Hmset regardless of existence or not, will be assigned to enter) 5>hmget setname field1 field2 ... hmget stuset name name1 name2:1) Zhangsan 2) Lisi 3) nil 6>hexists determine if a field exists in Set hexsits setname field hexists stuset name1:1 hexists stuset Name2:0 7>hl En view set number of fields Hlen setname hlen stuset:5 (field name name1 Namea nameb Namec) 8>hdel Delete field Hdel setname field Hdel stuset namec:1 Hdel stuset namec:0 9>hkeys View all fields of Set Hkeys setname hkeys stuname:1) name 2) name 1 3) Namea 4) NAMEB &NBsp;10>hvals View all valuehvals in set SetName hvals stuset:1) Zhangsan 2) Lisi 3) A 4) B 11>hgetall Get set all field Valuehgetall setname hgetall stuset:1) name 2) Zhangsan 3) name1 4) Lisi 5) Namea 6) A 7) Nameb 8) B 12>hincrby for field +xhincrby setname field x
Redis Operation Hash Test