Coder Social home page Coder Social logo

document pipelining about node-redis HOT 7 CLOSED

mranney avatar mranney commented on May 26, 2024
document pipelining

from node-redis.

Comments (7)

rjack avatar rjack commented on May 26, 2024

Does this mean that commands are serialized so that

client.set("key", "value");
client.set("key", "new value");
client.get("key", redis.print);

is always guaranteed to print new_value because commands are queued and sent in order, even if the single command calls are async?

Sorry if I'm asking an obvious question, but I still have to get used to node async paradigm.

from node-redis.

mranney avatar mranney commented on May 26, 2024

Yes, the commands on a single client connection are always run in order, and
the callbacks are always invoked in order.

On Fri, Apr 1, 2011 at 12:42 AM, rjack <
[email protected]>wrote:

Does this mean that commands are serialized so that

client.set("key", "value");
client.set("key", "new value");
client.get("key", redis.print);

is always guaranteed to print new_value because commands are queued and
sent in order, even if the single command calls are async?

Sorry if I'm asking an obvious question, but I still have to get used to
node async paradigm.

Reply to this email directly or view it on GitHub:
#49 (comment)

from node-redis.

rjack avatar rjack commented on May 26, 2024

Thanks :)

from node-redis.

courtneycouch avatar courtneycouch commented on May 26, 2024

Took a look around the source and don't see any logic to handle pipelining, and watching network activity while using node_redis I don't see any "automatic pipelining".

Might have just missed the pipelining pieces when looking around. Any chance for some quick addition to the README with a short example of pipelining a set of commands?

from node-redis.

mranney avatar mranney commented on May 26, 2024

Pipelining means sending a command without waiting for the response from the previous one. If you do this:

client.set("key1", "val1");
client.set("key2", "val2");

This will be pipelined. The second client.set command is sent before waiting for the response from the first set command .

from node-redis.

courtneycouch avatar courtneycouch commented on May 26, 2024

Ok so this is different than what pipelining means for redis I believe where
multiple commands can be sent simultaneously on the same connection. Then
results are delivered back together. Like a single batch of commands.
On Jun 12, 2011 5:30 PM, "mranney" <
[email protected]>
wrote:

from node-redis.

jhuttner avatar jhuttner commented on May 26, 2024

Is a single TCP connection connection used in the client.set("key1"); client.set("key2") example above, Matt? If not, then I don't think node_redis is pipelining in the technical sense of the word. Seems to me like this example results in two requests to the redis server, and two separate responses - the lack of a callback means the library simply doesn't execute a callback. Is this the correct understanding?

from node-redis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.