xredis-server 正在参加 2021 年度 OSC 中国开源项目评选,请投票支持!
xredis-server 在 2021 年度 OSC 中国开源项目评选 中已获得 {{ projectVoteCount }} 票,请投票支持!
2021 年度 OSC 中国开源项目评选 正在火热进行中,快来投票支持你喜欢的开源项目!
2021 年度 OSC 中国开源项目评选 >>> 中场回顾
xredis-server 获得 2021 年度 OSC 中国开源项目评选「最佳人气项目」 !
授权协议 MIT
开发语言 C/C++
操作系统 跨平台
软件类型 开源软件
所属分类 服务器软件Radius相关
开源组织
地区 国产
投 递 者 Sky
适用人群 未知
收录时间 2016-08-04

软件简介

xredis-server

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

xredis-server源码安装

git clone https://github.com/0xsky/xredis-server.git 
cd xredis-server.git
make

使用示例:

#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", 6379);

    while (1) {
        usleep(1000);
    }
    return 0;
}

相关文档:

使用示例  examples directory for some examples
github:https://github.com/0xsky/xredis-server

展开阅读全文

代码

的 Gitee 指数为
超过 的项目

评论

点击引领话题📣
发表了资讯
2016/10/11 00:00

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

xredis-server 1.0 发布了。xredis-server 是一个C++开发的redis服务器框架库,使用这个库可以很容易的开发自己的redis协议兼容服务器。 实现Redis服务端协议,支持auth认证命令. example: #include "../src/xRedisServerLib.h" class xRedisConnect :public xRedisConnectorBase { public:     xRedisConnect();     ~xRedisConnect(); private: }; class xRedisServer :public xRedisServerBase { public: ...

3
37
没有更多内容
加载失败,请刷新页面
点击加载更多
加载中
下一页
发表了博客
{{o.pubDate | formatDate}}

{{formatAllHtml(o.title)}}

{{parseInt(o.replyCount) | bigNumberTransform}}
{{parseInt(o.viewCount) | bigNumberTransform}}
没有更多内容
暂无内容
发表了问答
{{o.pubDate | formatDate}}

{{formatAllHtml(o.title)}}

{{parseInt(o.replyCount) | bigNumberTransform}}
{{parseInt(o.viewCount) | bigNumberTransform}}
没有更多内容
暂无内容
暂无内容
0 评论
12 收藏
分享
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部