xRedis
[](https://travis-ci.org/freeeyes/PSS)
[](https://opensource.org/licenses/Apache-2.0 )
[](https://badge.fury.io/gh/0xsky%2Fxredis)
======
C++ Redis client, support the data slice storage, redis cluster, connection pool, read/write separation.
**Features:**
* Support multi-node distributed storage of data, can customize the sharding rules;
* Support to connect to master and slave nodes of each shard at the same time, support separation of master and slave reads and writes;
* Support connection pooling for each storage node;
* Support simultaneous connection of multiple data sharding clusters;
* Support for connecting to official clusters, single or multiple nodes
Support to set up a connection pool to each node, the client side automatically calculates the slot distribution.
Support automatic calculation of node index position, support Redis cluster node change connection automatic switch;
The connection pool to the cluster is automatically updated when the add/delete /slot distribution of the official cluster node changes.
* Provide easy to use C++ interface encapsulation, has implemented most of the Redis command;
* Only rely on the Hiredis library;
* Multi-thread safety
* Support password connection;
* Support Linux and Windows platforms
中文版说明文档[点这里](https://github.com/0xsky/xredis/blob/master/README-cn.md)
### Dependencies
xredis requires hiredis only
### Install
First step install libhiredis, on a Debian system you can use:
```bash
sudo apt-get install libhiredis-dev
```
on centos/redhat/fedora system you can use:
```bash
sudo yum install hiredis-devel
```
Then checkout the code and compile it
```bash
git clone https://github.com/0xsky/xredis
cd xredis
make
sudo make install
```
Usage
```C++
#Accessing redis or redis Cluster using the xRedisClusterClient class
#include "xRedisClusterClient.h"
int main(int argc, char **argv) {
xRedisClusterClient redisclient;
# Connect to REDIS and establish a connection pool
# If this node is a member of the REDIS cluster,
# a connection pool is automatically established for each primary node in the cluster.
std::string passwd = "passwd123";
bool bRet = redisclient.connect("127.0.0.1", 6379, passwd, 4);
RedisResult result;
redisclient.command(result, "set %s %s", "key", "hello");
printf("type:%d integer:%lld str:%s \r\n",
result.type(), result.integer(), result.str());
while (true) {
usleep(1000*1000*6);
redisclient.keepalive();
}
return 0;
}
```
### Todo
Support redis sentinel
### Documentation

[xRedis API Site](http://xredis.0xsky.com/)<br>
See [examples](https://github.com/0xsky/xredis/blob/master/examples) directory for some examples<br>
blog: [xSky's Blog](https://0xsky.com/)<br>
xRedis QQ Group: 190107312
没有合适的资源?快使用搜索试试~ 我知道了~
Redis C++客户端,支持数据切片存储,支持redis集群,线程安全,多平台,连接池,读写分离 .zip

共44个文件
cpp:23个
h:7个
md:5个

1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 119 浏览量
2024-12-03
10:30:18
上传
评论
收藏 95KB ZIP 举报
温馨提示
重写Redis C++ Redis客户端,支持数据切片存储、Redis集群、连接池、读写分离。特征支持多节点分布式存储数据,可自定义分片规则支持同时连接各个Shard的主从节点,支持主从读写分离支持每个存储节点的连接池支持同时连接多个数据分片集群支持连接官方集群,单节点或者多节点 支持设置连接池到各个节点,客户端自动计算slot分配。 支持自动计算节点索引位置,支持Redis集群节点变化连接自动切换 当官方集群节点增删改查/slot分配发生变化时,自动更新到集群的连接池。提供简单易用的C++接口封装,已实现了大部分Redis命令仅依赖于 Hiredis 库多线程安全支持密码连接支持Linux和Windows平台中文版说明文档点这里依赖项xredis 仅需要 hiredis安装第一步安装 libhiredis,在 Debian 系统上您可以使用sudo apt-get install libhiredis-dev在 centos/redhat/fedora 系统上您可以使用sudo yum install hiredis-
资源推荐
资源详情
资源评论





























收起资源包目录



















































共 44 条
- 1
资源评论


赵闪闪168
- 粉丝: 1745
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- ctoc电子商务专题知识讲座.pptx
- C语言第7讲关系运算与逻辑运算if语句.ppt
- 基于单片机温度控制系统的设计.doc
- 基于AT89C52单片机的温室控制系统.doc
- 专题讲座资料(2021-2022年)单片机的红外防盗报警器.doc
- 购物网站策划书.doc
- 基于数据挖掘技术的负荷预测及主动设备维护可行性研究报告.doc
- 计算机教研组工作总结(2023年2023年第一学期).docx
- 【源版】第五章-数据库技术基础.ppt
- 工厂数字化网络监控系统解决方案.doc
- 网络谣言的传播与成因.ppt
- 基于GPS车辆跟踪系统的移动对象数据库应用研究.doc
- 光纤通信(第5版)课后习题答案要点.doc
- 高中数学第1章算法初步章末复习与总结课件新人教A版必修.ppt
- 网络研修学习总结.doc
- 中小型企业网站建设方案模板.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
