redis的c客户端hiredis使用札记

redis的c客户端项目是hiredis,是由redis官方提供的,它提供了一系列封装好的api,使用起来很容易上手.

该项目的链接在:

https://github.com/redis/hiredis

安装方式:

git clone https://github.com/redis/hiredis.git
cd hiredis
make 
make install

安装后的头文件和库文件被放到/usr/local/include和/usr/local/lib下.为了方便使用,可以把他们添加到搜索路径下:(默认的搜索路径)

在/etc/profile的最下端加上下面的语句(/etc/profile是针对所有用户的,不过每次用户切换时都需要source一下)也可以设置到~/.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不支持集群,hiredis-vip项目支持集群:

C    https://github.com/vipshop/hiredis-vip.git

参考文献:https://blog.csdn.net/for_tech/article/details/51917831

新战场:https://blog.csdn.net/Stephen___Qin
原文地址:https://www.cnblogs.com/Stephen-Qin/p/12837215.html