sewenew / redis-plus-plus

Redis client written in C++
Apache License 2.0
1.64k stars 351 forks source link

[QUESTION] Whether the call of any synchronous blocking interface will not exceed the socket_timeout? #420

Closed lxycomeon closed 1 year ago

lxycomeon commented 1 year ago

Whether the call of any synchronous blocking interface will not exceed the socket_timeout?

Thanks

sewenew commented 1 year ago

Yes, if you set socket_timeout larger than 0 milliseconds.

Regards

lxycomeon commented 1 year ago

Some interfaces only return future. Is there any way to support callback function processing?

Thanks

sewenew commented 1 year ago

You can use the generic interface to send async command with callback:

async_redis.command<long long>("incr", "number",
        [](Future<long long> &&fut) {
            try {
                cout << fut.get() << endl;
            } catch (const Error &e) {
                // handle error
            }
        });

Also, you're always welcome to create pull requests to add built-in support for these commands :)

Regards

sewenew commented 1 year ago

Since there's no update, I'll close this issue.

If you still have problem, feel free to reopen it. If redis-plus-plus is helpful, feel free to star it :)

Regards