300 字 | 1 分钟
iterall storeid hex num
Available since 1.0.0.
命令说明
用于迭代所有的key value。
输入参数:storeid hex num
其中hex第一次传入0,返回的hex值用于下一次迭代,可以反复迭代,直到返回hex为0表示结束。
命令返回
下一次迭代用的hex
数据库中的key value列表,格式如下:
1)数据类型,参见下面的RecordType
2)dbId
3)一级key
4)二级key
5)value
enum class RecordType {
RT_INVALID,
RT_META, /* For catalog */
RT_KV, /* For realtype in RecordValue */
RT_LIST_META, /* For realtype in RecordValue */
RT_LIST_ELE, /* For list subkey type in RecordKey and RecordValue */
RT_HASH_META, /* For realtype in RecordValue */
RT_HASH_ELE, /* For hash subkey type in RecordKey and RecordValue */
RT_SET_META, /* For realtype in RecordValue */
RT_SET_ELE, /* For set subkey type in RecordKey and RecordValue */
RT_ZSET_META, /* For realtype in RecordValue */
RT_ZSET_S_ELE, /* For zset subkey type in RecordKey and RecordValue */
RT_ZSET_H_ELE, /* For zset subkey type in RecordKey and RecordValue */
RT_BINLOG, /* For binlog in RecordKey and RecordValue */
RT_TTL_INDEX, /* For ttl index in RecordKey and RecordValue */
RT_DATA_META, /* For key type in RecordKey */
};
Example
127.0.0.1:51003> hset myhash key1 value1
127.0.0.1:51003> set a 1
127.0.0.1:51003> set b 2
127.0.0.1:51003> iterall 0 0 2
1) "00003C8744000000006100000100"
2) 1) 1) "2"
2) "0"
3) "b"
4) ""
5) "2"
2) 1) "6"
2) "0"
3) "myhash"
4) "key1"
5) "value1"