• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ redisvFormatCommand函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ redo函数代码示例发布时间:2022-05-30
下一篇:
C++ redisPanic函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap