1. hiredis
这时redis自带的官方的C语言API。安装很简单:
# cd {redis-src}
# cd deps/hiredis/
# make
# make install
现在hiredis已经被安装于/usr/local/include/hiredis/和/usr/local/lib/下。为了方便,设置一下头文件和lib文件的路径:
# vim ~/.bashrc
#compile time, paths to search included headers, referenced libs;
export C_INCLUDE_PATH=.:/usr/local/include/hiredis:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=.:/usr/local/include/hiredis:$CPLUS_INCLUDE_PATH
export LIBRARY_PATH=.:/usr/local/lib:$LIBRARY_PATH
#runtime, paths to search referenced libs;
export LD_LIBRARY_PATH=.:/usr/local/lib:$LD_LIBRARY_PATH
然后,就可以基于hiredis API开发客户端了。可是hiredis不支持集群。支持集群的API:
C++ https://github.com/eyjian/r3cC++ https://github.com/zhengshuxin/a