设为首页收藏本站

LUPA开源社区

 找回密码
 注册
文章 帖子 博客
LUPA开源社区 首页 业界资讯 软件追踪 查看内容

xredis-server 1.0发布,Redis服务器框架库

2016-10-11 22:44| 发布者: joejoe0332| 查看: 963| 评论: 0|原作者: oschina|来自: oschina

摘要: xredis-server 1.0 发布了。xredis-server是一个C++开发的redis服务器框架库,使用这个库可以很容易的开发自己的redis协议兼容服务器。实现Redis服务端协议,支持auth认证命令.example:?123456789101112131415161718 ...

xredis-server 1.0 发布了。xredis-server 是一个C++开发的redis服务器框架库,使用这个库可以很容易的开发自己的redis协议兼容服务器。

实现Redis服务端协议,支持auth认证命令.

example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include "../src/xRedisServerLib.h"
 
class xRedisConnect :public xRedisConnectorBase
{
public:
    xRedisConnect();
    ~xRedisConnect();
private:
};
 
class xRedisServer :public xRedisServerBase
{
public:
    xRedisServer() {}
    ~xRedisServer() {}
public:
    bool Init()
    {
        CmdRegister();
    }
private:
    bool CmdRegister()
    {
        if (!SetCmdTable("get", (CmdCallback)&xRedisServer::ProcessCmd_get)) return false;
        return true;
    }
    void ProcessCmd_get(xRedisConnect *pConnector)
    {
        if (2 != pConnector->argc) {
            SendErrReply(pConnector, "cmd error:""error arg");
            return;
        }
        SendBulkReply(pConnector, pConnector->argv[1]);
        return;
    }
private:
};
 
int main(int argc, char **argv)
{
    xRedisServer xRedis;
    xRedis.Init();
    std::string pass = "123456";
    xRedis.SetPassword(pass);
    xRedis.Start("127.0.0.1", 6479);
 
    while (1) {
        usleep(1000);
    }
     
    return 0;
}

酷毙

雷人

鲜花

鸡蛋

漂亮
  • 快毕业了,没工作经验,
    找份工作好难啊?
    赶紧去人才芯片公司磨练吧!!

最新评论

关于LUPA|人才芯片工程|人才招聘|LUPA认证|LUPA教育|LUPA开源社区 ( 浙B2-20090187 浙公网安备 33010602006705号   

返回顶部