- hash用于存储对象,对象的格式为键值对
- 设置单个属性
127.0.0.1:6379> hset book name '小红'
(integer) 1
127.0.0.1:6379> type book
hash
127.0.0.1:6379>
127.0.0.1:6379> hmset book name 'xiaohong' gender 0
OK
127.0.0.1:6379>
127.0.0.1:6379> hget book gender
"0"
127.0.0.1:6379> hget book name
"xiaohong"
127.0.0.1:6379> keys *
1) "abcd"
2) "book"
3) "py3"
127.0.0.1:6379>
127.0.0.1:6379> hgetall book
1) "name"
2) "xiaohong"
3) "gender"
4) "0"
127.0.0.1:6379>
127.0.0.1:6379> hkeys book
1) "name"
2) "gender"
127.0.0.1:6379>
127.0.0.1:6379> hvals book
1) "xiaohong"
2) "0"
127.0.0.1:6379>
127.0.0.1:6379> hexists book 888
(integer) 0
127.0.0.1:6379>
127.0.0.1:6379> hdel book name
(integer) 1
127.0.0.1:6379>
127.0.0.1:6379> HSTRLEN a name
(error) ERR unknown command 'HSTRLEN'
127.0.0.1:6379> hmset myhash f1 'helloworld' f2 99 f3 -345
OK
127.0.0.1:6379> hstrlen myhash f1
(error) ERR unknown command 'hstrlen'
127.0.0.1:6379>