设为首页 加入收藏

TOP

linux下redis的安装,使用(二)
2015-07-24 10:27:01 来源: 作者: 【 】 浏览:2
Tags:linux redis 安装 使用
对于每一个子应答,无需使用者单独释放,只需释放最外部的redisReply即可。 freeReplyObject(r); printf("Succeed to execute command[%s].\n",command5); printf("Begin to test pipeline.\n"); //该命令只是将待发送的命令写入到上下文对象的输出缓冲区中,直到调用后面的 //redisGetReply命令才会批量将缓冲区中的命令写出到Redis服务器。这样可以 //有效的减少客户端与服务器之间的同步等候时间,以及网络IO引起的延迟。 //至于管线的具体性能优势,可以考虑该系列博客中的管线主题。 /* if (REDIS_OK != redisAppendCommand(c,command1) || REDIS_OK != redisAppendCommand(c,command2) || REDIS_OK != redisAppendCommand(c,command3) || REDIS_OK != redisAppendCommand(c,command4) || REDIS_OK != redisAppendCommand(c,command5)) { redisFree(c); return; } */ redisAppendCommand(c,command1); redisAppendCommand(c,command2); redisAppendCommand(c,command3); redisAppendCommand(c,command4); redisAppendCommand(c,command5); redisReply* reply = NULL; //对pipeline返回结果的处理方式,和前面代码的处理方式完全一直,这里就不再重复给出了。 if (REDIS_OK != redisGetReply(c,(void**)&reply)) { printf("Failed to execute command[%s] with Pipeline.\n",command1); freeReplyObject(reply); redisFree(c); } freeReplyObject(reply); printf("Succeed to execute command[%s] with Pipeline.\n",command1); if (REDIS_OK != redisGetReply(c,(void**)&reply)) { printf("Failed to execute command[%s] with Pipeline.\n",command2); freeReplyObject(reply); redisFree(c); } freeReplyObject(reply); printf("Succeed to execute command[%s] with Pipeline.\n",command2); if (REDIS_OK != redisGetReply(c,(void**)&reply)) { printf("Failed to execute command[%s] with Pipeline.\n",command3); freeReplyObject(reply); redisFree(c); } freeReplyObject(reply); printf("Succeed to execute command[%s] with Pipeline.\n",command3); if (REDIS_OK != redisGetReply(c,(void**)&reply)) { printf("Failed to execute command[%s] with Pipeline.\n",command4); freeReplyObject(reply); redisFree(c); } freeReplyObject(reply); printf("Succeed to execute command[%s] with Pipeline.\n",command4); if (REDIS_OK != redisGetReply(c,(void**)&reply)) { printf("Failed to execute command[%s] with Pipeline.\n",command5); freeReplyObject(reply); redisFree(c); } freeReplyObject(reply); printf("Succeed to execute command[%s] with Pipeline.\n",command5); //由于所有通过pipeline提交的命令结果均已为返回,如果此时继续调用redisGetReply, //将会导致该函数阻塞并挂起当前线程,直到有新的通过管线提交的命令结果返回。 //最后不要忘记在退出前释放当前连接的上下文对象。 redisFree(c); return; } int main() { doTest(); return 0; }

memcache: http://php.net/manual/zh/book.memcache.php http://docs.linuxtone.org/ebooks/NOSQL/memcached/memcached--%E9%BB%91%E5%A4%9C%E8%B7%AF%E4%BA%BA.pdf
gcc 源码编译: http://www.cnblogs.com/codemood/archive/2013/06/01/3113200. html 下载地址:http://ftp.gnu.org/ GNU的ftp服务器下载
首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇什么是统计信息以及收集查看方法 下一篇EBSfnd_new_messages表中的数据被..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·bios设置按什么选择 (2025-12-26 17:20:08)
·知乎 - 知乎 (2025-12-26 17:20:04)
·http://和www.前缀网 (2025-12-26 17:20:01)
·Python爬虫教程(从 (2025-12-26 16:49:14)
·【全269集】B站最详 (2025-12-26 16:49:11)