可以重新编写管道依赖于前面的多个命令吗? [英] Can redis pipeline multiple commands that depend on previous ones?

查看:116
本文介绍了可以重新编写管道依赖于前面的多个命令吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对redis非常新,还在玩弄它。我想测试看看它是否与我的项目相关,但我不知道一个具体的命令,我运行。对这样的用户都让我确信使用管道和交易的性能优势,所以我认为我会问如何做到这一点。

I'm very very new to redis and still playing around with it. I want to test to see if its relevant to my project but I'm not sure about a specific command I'm running. The users on SO have got me convinced of the performance benefits of using pipelines and transactions so I thought I'd ask how to do this.

基本上我有两个语句我只是想发出,而不必等待结果(似乎是一个很好的候选人管道内衬它看起来是这样的:

Basically I have two statements that I just want to issue and not have to wait for the result(seems like a good candidate for pipe lining. It looks like this:

Does valueX exist?
If it does insert valueY

它很简单,但到目前为止,所有我一直在寻找到它的途径似乎等待了,如果ValueX存在的反应,因为我在做十亿以上的环我的程序它,它嘎然而止的。

Its pretty simple but so far all the ways I have been looking into it seem to wait for a response for if ValueX exists, and because I'm doing over a billion loops of my program it grinds it to a halt.

这是可能吗?如果它帮助我使用Java,但还没有解决哪个客户端库(jedis或jredis,仍然测试)。我实际上甚至没有完全解决redis,

Is this possible? If it helps I'm using Java but haven't settled on which client library(jedis or jredis, still testing). I'm actually not even fully settled on redis but leaning very heavily towards it(seems good for what I'm doing speed wise), so any suggestions are acceptable.

推荐答案

不,它不是可能会暂时完成这样的事情。你所寻求的是一个功能目前缺少,但它将与2.6版本的Redis可用。它被称为LUA脚本。您可以执行依赖于先前命令的服务器命令,而不需要在客户端提取它们。有关详情,请参阅此处

No, it is not possible for the moment to accomplish such a thing. What you seek is a feature missing for the moment, but it will be available with the 2.6 version of Redis. It's called LUA scripting. You can execute server commands that are dependent of previous commands, all in one, without the need to fetch them at the client. For more details see here.

这篇关于可以重新编写管道依赖于前面的多个命令吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆