Cylix / cpp_redis

C++11 Lightweight Redis client: async, thread-safe, no dependency, pipelining, multi-platform - NO LONGER MAINTAINED - Please check https://github.com/cpp-redis/cpp_redis
MIT License
1.25k stars 554 forks source link

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

Open pengweichu opened 6 years ago

pengweichu commented 6 years ago

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

Thanks

pengweichu commented 6 years ago

Please help, thanks in advance.

Eggache666 commented 6 years ago
    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);