Can redis pipeline multiple commands that depend on previous ones?

I am very new to redis and still play with it. I want to check if this matches my project, but I'm not sure about the specific command that I am running. Users at SO convinced me of the 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 release and don't have to wait for the result (it seems like a good candidate for pipe lining. It looks like this:

Does valueX exist? If it does insert valueY 

Its quite simple, but so far all the ways that I have been doing it seem to be waiting for an answer, if ValueX exists, and because I am doing more than a billion cycles of my program, it stops it.

Is it possible? If this helps, I use Java, but have not decided which client library (jedis or jredis, still checking). I'm actually not even completely settled on redis, but I really lean towards it (it seems good that I am doing speed), so any suggestions are acceptable.

+6
source share
1 answer

No, at the moment it is impossible to accomplish such a thing. What you are looking for is not available at the moment, but it will be available with Redis version 2.6. It was called the LUA script. You can execute server commands that depend on previous commands, all in one, without having to retrieve them on the client. See here for more details.

+6
source

Source: https://habr.com/ru/post/910223/


All Articles