Score
0
Watch 23 Star 50 Fork 20

xSky / xredis-serverC++MIT

Create your Gitee Account
Explore and code with more than 5 million developers,Free private repositories !:)
Sign up
Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

Author Platform NoSQL License

xredis-server

redis-server is a redis server framework library write by C++, using this library you can develop redis protocol compatible server easily.

Dependencies

xredis-server requires libevent

###install

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

###build example

make example

###usage:

#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();
    xRedis.Start("127.0.0.1", 6379);

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

DOC

example [examples](https://github.com/0xsky/xredis-server/tree/master/example) directory for some examples

QQ Group: 190107312

author: xSky

Blog: xSky's Blog

Comments ( 0 )

Sign in for post a comment

About

C++开发的redis服务器框架库, 使用这个库可以很容易的开发自己的redis协议兼容服务器 spread retract
C++
MIT
Cancel

Releases

No release

Gitee Metrics

Contributors

All

Activities

load more
can not load any more