本文整理汇总了C++中redisvFormatCommand函数的典型用法代码示例。如果您正苦于以下问题:C++ redisvFormatCommand函数的具体用法?C++ redisvFormatCommand怎么用?C++ redisvFormatCommand使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了redisvFormatCommand函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: redisvAppendCommand
void redisvAppendCommand(redisContext *c, const char *format, va_list ap) {
char *cmd;
int len;
len = redisvFormatCommand(&cmd,format,ap);
__redisAppendCommand(c,cmd,len);
free(cmd);
}
开发者ID:emiraga,项目名称:wikigraph,代码行数:7,代码来源:hiredis.c
示例2: redisFormatCommand
/* Format a command according to the Redis protocol. This function
* takes a format similar to printf:
*
* %s represents a C null terminated string you want to interpolate
* %b represents a binary safe string
*
* When using %b you need to provide both the pointer to the string
* and the length in bytes. Examples:
*
* len = redisFormatCommand(target, "GET %s", mykey);
* len = redisFormatCommand(target, "SET %s %b", mykey, myval, myvallen);
*/
int redisFormatCommand(char **target, const char *format, ...) {
va_list ap;
int len;
va_start(ap,format);
len = redisvFormatCommand(target,format,ap);
va_end(ap);
return len;
}
开发者ID:esromneb,项目名称:hiredis,代码行数:20,代码来源:hiredis.c
示例3: redisvAsyncCommand
int redisvAsyncCommand(redisAsyncContext *ac, redisCallbackFn *fn, void *privdata, const char *format, va_list ap) {
char *cmd;
int len;
int status;
len = redisvFormatCommand(&cmd,format,ap);
status = __redisAsyncCommand(ac,fn,privdata,cmd,len);
free(cmd);
return status;
}
开发者ID:cyclades,项目名称:Nowtable,代码行数:9,代码来源:async.c
示例4: redisvFormatCommand
void *redisvCommand(redisContext *c, const char *format, va_list ap) {
char *cmd;
int len;
void *reply = NULL;
len = redisvFormatCommand(&cmd,format,ap);
reply = __redisCommand(c,cmd,len);
free(cmd);
return reply;
}
开发者ID:emiraga,项目名称:wikigraph,代码行数:9,代码来源:hiredis.c
示例5: redisvFormatCommand
int redis_request::append_vcommand(const char *format, va_list ap) {
char *cmd = NULL;
int len = redisvFormatCommand(&cmd, format, ap);
if (len == -1) {
WRITE_LOG(LOG_FATAL, "outof memory");
return -1;
}
reqs.push_back(std::make_pair(cmd, static_cast<size_t>(len)));
WRITE_LOG(LOG_DEBUG, "append command '%s' len %d OK", cmd, len);
return 0;
}
开发者ID:zade,项目名称:redis-wrapper,代码行数:13,代码来源:redis_wrapper.cpp
示例6: redisFormatCommand
/* Format a command according to the Redis protocol. This function
* takes a format similar to printf:
*
* %s represents a C null terminated string you want to interpolate
* %b represents a binary safe string
*
* When using %b you need to provide both the pointer to the string
* and the length in bytes as a size_t. Examples:
*
* len = redisFormatCommand(target, "GET %s", mykey);
* len = redisFormatCommand(target, "SET %s %b", mykey, myval, myvallen);
*/
int redisFormatCommand(char **target, const char *format, ...) {
va_list ap;
int len;
va_start(ap,format);
len = redisvFormatCommand(target,format,ap);
va_end(ap);
/* The API says "-1" means bad result, but we now also return "-2" in some
* cases. Force the return value to always be -1. */
if (len < 0)
len = -1;
return len;
}
开发者ID:TakedWind,项目名称:fastoredis,代码行数:26,代码来源:hiredis.c
示例7: redisvAsyncCommand
int redisvAsyncCommand(redisAsyncContext *ac, redisCallbackFn *fn, void *privdata, const char *format, va_list ap) {
char *cmd;
int len;
int status;
len = redisvFormatCommand(&cmd,format,ap);
/* We don't want to pass -1 or -2 to future functions as a length. */
if (len < 0)
return REDIS_ERR;
status = __redisAsyncCommand(ac,fn,privdata,cmd,len);
free(cmd);
return status;
}
开发者ID:435420057,项目名称:EasyDarwin,代码行数:14,代码来源:async.c
示例8: redisc_append_cmd
int redisc_append_cmd(str *srv, str *res, str *cmd, ...)
{
redisc_server_t *rsrv=NULL;
redisc_reply_t *rpl;
char c;
va_list ap;
va_start(ap, cmd);
if(srv==NULL || cmd==NULL || res==NULL)
{
LM_ERR("invalid parameters");
goto error_cmd;
}
if(srv->len==0 || res->len==0 || cmd->len==0)
{
LM_ERR("invalid parameters");
goto error_cmd;
}
rsrv = redisc_get_server(srv);
if(rsrv==NULL)
{
LM_ERR("no redis server found: %.*s\n", srv->len, srv->s);
goto error_cmd;
}
if(rsrv->ctxRedis==NULL)
{
LM_ERR("no redis context for server: %.*s\n", srv->len, srv->s);
goto error_cmd;
}
if (rsrv->piped.pending_commands >= MAXIMUM_PIPELINED_COMMANDS)
{
LM_ERR("Too many pipelined commands, maximum is %d\n",MAXIMUM_PIPELINED_COMMANDS);
goto error_cmd;
}
rpl = redisc_get_reply(res);
if(rpl==NULL)
{
LM_ERR("no redis reply id found: %.*s\n", res->len, res->s);
goto error_cmd;
}
c = cmd->s[cmd->len];
cmd->s[cmd->len] = '\0';
rsrv->piped.commands[rsrv->piped.pending_commands].len = redisvFormatCommand(
&rsrv->piped.commands[rsrv->piped.pending_commands].s,
cmd->s,
ap);
if (rsrv->piped.commands[rsrv->piped.pending_commands].len < 0)
{
LM_ERR("Invalid redis command : %s\n",cmd->s);
goto error_cmd;
}
rsrv->piped.replies[rsrv->piped.pending_commands]=rpl;
rsrv->piped.pending_commands++;
cmd->s[cmd->len] = c;
va_end(ap);
return 0;
error_cmd:
va_end(ap);
return -1;
}
开发者ID:shenya,项目名称:kamailio,代码行数:65,代码来源:redis_client.c
注:本文中的redisvFormatCommand函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论