mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-11-30 10:57:34 +08:00
fixed bug for redis scan in class redis_command/redis_key/redis_hash/redis_set/redis_zset
This commit is contained in:
parent
bc119e8199
commit
bfebe1b5d3
@ -1,6 +1,10 @@
|
||||
修改历史列表:
|
||||
|
||||
------------------------------------------------------------------------
|
||||
349) 2015.8.24
|
||||
349.1) bugfix: redis_command/redis_key/redis_hash/redis_set/redis_zset 在
|
||||
遍历过程中,可能服务端会返回 cursor 为 > 0 但结果集为空的情况,需要对这种情况进行处理
|
||||
|
||||
348) 2015.8.20
|
||||
348.1) compile: zlib_stream 类内部使用了动态加载 zlib 库的方式。
|
||||
|
||||
|
@ -321,7 +321,7 @@ public:
|
||||
* scan finish
|
||||
* -1: ³ö´í
|
||||
* some error happened
|
||||
* >0: 游标的下一个位置
|
||||
* >0: 游标的下一个位置,即使这样,具体有多少结果还需要检查 out,因为有可能为空
|
||||
* the next cursor postion to scan
|
||||
*/
|
||||
int hscan(const char* key, int cursor, std::map<string, string>& out,
|
||||
|
@ -390,7 +390,7 @@ public:
|
||||
* iterating is finished
|
||||
* -1: ³ö´í
|
||||
* some error happened
|
||||
* >0: 游标的下一个位置
|
||||
* >0: 游标的下一个位置,即使这样,具体有多少结果还需要检查 out,因为有可能为空
|
||||
* the next cursor value for iterating
|
||||
*/
|
||||
int scan(int cursor, std::vector<string>& out,
|
||||
|
@ -346,7 +346,7 @@ public:
|
||||
* scan finish
|
||||
* -1: ³ö´í
|
||||
* some error happened
|
||||
* >0: 游标的下一个位置
|
||||
* >0: 游标的下一个位置,即使这样,具体有多少结果还需要检查 out,因为有可能为空
|
||||
* the next cursor postion to scan
|
||||
*/
|
||||
int sscan(const char* key, int cursor, std::vector<string>& out,
|
||||
|
@ -469,7 +469,7 @@ public:
|
||||
* @return {int} 下一个游标位置,含义如下:
|
||||
* 0:遍历结束
|
||||
* -1: 出错
|
||||
* >0: 游标的下一个位置
|
||||
* >0: 游标的下一个位置,即使这样,具体有多少结果还需要检查 out,因为有可能为空
|
||||
*/
|
||||
int zscan(const char* key, int cursor,
|
||||
std::vector<std::pair<string, double> >& out,
|
||||
|
@ -19,7 +19,7 @@ int main(int argc, char* argv[])
|
||||
if (argc >= 2 && strcmp(argv[1], "alone") == 0)
|
||||
{
|
||||
acl::log::stdout_open(true); // 日志输出至标准输出
|
||||
const char* addr = "127.0.0.1:8888, 127.0.0.1:8889";
|
||||
const char* addr = ":8888, 127.0.0.1:8889";
|
||||
printf("bind on: %s\r\n", addr);
|
||||
ms.run_alone(addr, NULL, 0); // 单独运行方式
|
||||
}
|
||||
|
@ -54,8 +54,8 @@ void master_service::on_read(acl::socket_stream* stream)
|
||||
logger_error("write to %s error %s",
|
||||
stream->get_peer(true), acl::last_serror());
|
||||
if (0)
|
||||
logger(">>Peer: %s, Local: %s", stream->get_peer(true),
|
||||
stream->get_local(true));
|
||||
logger(">>Peer: %s, Local: %s", stream->get_peer(true),
|
||||
stream->get_local(true));
|
||||
}
|
||||
|
||||
void master_service::proc_on_init()
|
||||
|
@ -24,7 +24,7 @@ static void run(void)
|
||||
else
|
||||
stream.set_peer(__server_addr);
|
||||
|
||||
stream.set_rw_timeout(0);
|
||||
stream.set_rw_timeout(1);
|
||||
|
||||
// 分配内存
|
||||
buf = (char*) malloc(__dat_length + 1);
|
||||
@ -57,7 +57,7 @@ static void run(void)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == 0)
|
||||
if (i % 1000 == 0)
|
||||
{
|
||||
res[ret] = 0;
|
||||
printf("read >>> %s\r\n", res);
|
||||
|
@ -1122,7 +1122,7 @@ const redis_result** redis_command::scan_keys(const char* cmd, const char* key,
|
||||
const redis_result** children = rr->get_children(&size);
|
||||
if (children == NULL)
|
||||
{
|
||||
cursor = 0;
|
||||
//cursor = 0;
|
||||
size = 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user