命令 | 语法 | 描述 | 示例 | 备注 |
HSET | HSET key-name key value | 添加key-value到hash中 | HSET hash-key key1 value1 | |
HGET | HGET key-name key | 返回hash中key的值 | HGET hash-key key1 | |
HDEL | HGET key-name key | 删除hash的key | HDEL hash-key key1 | |
HMSET | HMSET key-name key value [key value ...] | 一次添加多个key-value到hash中 | HMSET hash-key2 key1 value1 key2 value2 | |
HMGET | HMGET key-name key [key...] | 一次返回多个key的值 | HMGET hash-key2 key1 key2 | |
HLEN | HLEN key-name | 返回hash元素个数 | HLEN hash-key2 | |
HEXISTS | HEXISTS key-name key | 判断是否包含key的键 | HEXISTS hash-key2 key2 | |
HKEYS | HKEYS key-name | 返回hash中所有key | HKEYS hash-key2 | key1 key2 |
HVALS | HVALS key-name | 返回hash中所有value | HVALS hash-key2 | value1 value2 |
HGETALL | HGETALL key-name | 返回所有key-value | HGETALL hash-key2 | |
HINCRBY | HINCRBY key-name key count | 对hash中key的值增加count | HINCRBY hash-key2 key3 1 | |
HINCRBYFLOAT | HINCRBYFLOAT key-name key count | 对hash中key的值增加count | HINCRBY hash-key2 key3 2.0 |
Redis数据类型及其操作—Hashes,布布扣,bubuko.com
原文:http://www.cnblogs.com/wayhow/p/3643789.html