最新版本是redis3.0,需要用vs2015版本編譯
redis-3.0\msvs目錄下面,開啟 編譯 x64
redis-3.0\msvs\x64\debug下面會有對應的debug庫
redis.c檔案有main函式:
main()->initserverconfig() 初始化配置
main()->initserver()啟動服
啟動執行除錯
二:測試
在redis-3.0\deps\hiredis\examples\example.c檔案裡面有demo測試檔案
vs2015新建乙個 win32控制台應用程式
1:設定 編譯平台為 x64
2:新增引用包含標頭檔案 .\redis-3.0\deps\hiredis
3:新增引用包含lib .\redis-3.0\msvs\x64\debug
測試如下**:
#include
#include
#include "hiredis.h"
#pragma comment(lib, "ws2_32.lib")
#pragma comment(lib, "hiredis.lib")
#pragma comment(lib, "win32_interop.lib")
int main(int argc,int **argv)
{wsadata wsadata;
wsastartup(makeword(2, 1), &wsadata);
rediscontext *c = nullptr;
redisreply *reply =null;
const char *hostname = "127.0.0.1";
int port = 6379;
timeval st;
st.tv_sec = 1;
st.tv_usec = 500000;
c = redisconnectwithtimeout(hostname, port, st);
reply = (redisreply*)rediscommand(c, "ping");
printf("ping: %s\n", reply->str);
freereplyobject(reply);
reply = (redisreply*)rediscommand(c, "set uid_1 11");
printf("set: %s\n", reply->str);
freereplyobject(reply);
reply = (redisreply*)rediscommand(c, "get uid_1");
printf("get uid_1: %s\n", reply->str);
freereplyobject(reply);
redisfree(c);
printf("test--begin");
return 0;
測試執行如下:
set:ok
get:uid_1:11
Redis benchmark測試Redis效能
redis benchmark是官方自帶的redis效能測試工具,可以有效的測試redis服務的效能。使用說明如下 usage redis benchmark h p c n k h server hostname default 127.0.0.1 p server port default 63...
Redis benchmark測試Redis效能
引自 redis benchmark為redis效能測試工具。指令說明 usage redis benchmark h p c n k h server hostname default 127.0.0.1 p server port default 6379 s server socket ove...
Redis benchmark測試Redis效能
引自 redis benchmark為redis效能測試工具。指令說明 usage redis benchmark h p c n k h server hostname default 127.0.0.1 p server port default 6379 s server socket ove...