Closed wb2712 closed 1 year ago
Thanks for the suggestion! I'll take a look on how to implement it. It seems not an easy fix, since we need to ensure the code can work compatibly with old version of hiredis, i.e. hiredis without such an interface.
I'll let you know, if I get some progress.
Regrads
I've added support for this feature. You can try the latest code on dev branch. Also you should install the latest hiredis on master branch to have this support.
ConnectionOptions opts;
opts.host = "127.0.0.1";
opts.port = 6379;
opts.keep_alive_s = std::chrono::seconds(1);
auto r = Redis(opts);
Since this is a new API for hiredis, I need to use cmake to check if this feature is supported, and dynamically create a hiredis_features.h
which includes some feature testing macro. Not sure if this is the best way to make the code compatible with hiredis of any version. So I need to make some more tests and do some more research before merging the code into master branch. If you have any feedback on the implementation, feel free to let me know :)
Sorry for the late reply, too busy these days...
Regards
Code has been merged into master branch.
Regards
hiredis Allow specifying the keepalive interval #1168