cpp_redis icon indicating copy to clipboard operation
cpp_redis copied to clipboard

When I send the SCAN, how can I obtain the cursor and returned list?

Open pengweichu opened this issue 6 years ago • 2 comments

When I send the SCAN, how can I obtain the cursor and returned list?

Thanks

pengweichu avatar Sep 04 '18 14:09 pengweichu

Please help, thanks in advance.

pengweichu avatar Sep 05 '18 12:09 pengweichu

	size_t cursor = 0;
	do
	{
		auto rep = client.scan(cursor, "keys*");
		client.sync_commit();
		auto res = rep.get().as_array();
		cursor = std::stoi(res[0].as_string());
		auto return_list = res[1].as_array();
                    // ...

	} while (cursor != 0);

Eggache666 avatar Nov 01 '18 01:11 Eggache666