hiredis

redis

编译

g++ main.cpp -lhiredis

使用

#include<hiredis/hiredis.h>

redisContext* l_redis_context = redisConnect("127.0.0.1", 6379);

if (l_redis_context == nullptr)
{
    std::cout << " redis null " << std::endl;
    return;
}
    
redisCommand(l_redis_context, "LPUSH key_name %b", l_str.c_str(), l_str.size());

hiredis基础知识

redisReply结构体

  • redisReply

  • redisReply-type

redis-ERR

  • err

常用函数

  • 连接

  • 执行命令

  • 释放redisReply

最后更新于

这有帮助吗?