C++ redis命令错误:参数hiredis的数目错误
当我通过hiredis适配器执行“脚本加载”命令时,我得到了错误的参数no。通过Redis客户端执行的相同命令运行正常。C++ redis命令错误:参数hiredis的数目错误,c++,c,redis,lua,C++,C,Redis,Lua,当我通过hiredis适配器执行“脚本加载”命令时,我得到了错误的参数no。通过Redis客户端执行的相同命令运行正常。 reply_r= (redisReply *)redisCommand(con_r,"script","load", "return 1"); string stemp=""; if(reply_r->len>0) { str
reply_r= (redisReply *)redisCommand(con_r,"script","load", "return 1");
string stemp="";
if(reply_r->len>0)
{
string stt(reply_r->str);
stemp=stt;
//printf("Commad Reply : %s\n", reply_r->str);
}
freeReplyObject(reply_r);// should free the object after reading the data
return stemp;
最好检查返回的
reply\r
是否为null ptr。非主题:您也可以尝试,它内置了对SCRIPTS LOAD
命令的支持:auto sha=redis.script_LOAD(“return 1”)
最好检查返回的reply\r
是否为null ptr。非主题:您也可以尝试,它内置了对SCRIPTS LOAD
命令的支持:auto sha=redis.script_LOAD(“return 1”)代码>
reply_r= (redisReply *)redisCommand(con_r,"scrips load %s", "return 1");
string stemp="";
if(reply_r->len>0 && reply_r!=NULL)
{
stemp=string(reply_r->str);
}
freeReplyObject(reply_r);// should free the object after reading the data
return stemp;