04.Hash相关命令


HEXISTS key field
HKEYS key
HLEN key
HSTRLEN key field
HVALS key
HSCAN key cursor [MATCH pattern] [COUNT count]

HSET key field value [field value ...]
HSETNX key field value
HMSET key field value [field value ...]
HDEL key field [field ...]
HGET key field
HGETALL key
HMGET key [field ...]
HRANDFIELD key [count [WITHVALUES]]

HINCREBY key field increment
HINCREBYFLOAT key field increment

数据结构

Hash类型对应的数据结构是两种:ZipList和HashTable。当FieldValue长度较短且个数较少时,使用ZipList,否则使用HashTable。

参考资料

  1. Redis#Hash