Tuesday, 15 January 2013

node.js - NodeJS and Redis : getting three values simultaneously -


Currently, I get many values ​​with node-radis in nodejs and radis:

< (Redis.get ('data2', function (error, data2) {redis.get ('data3', function (error, Data 3) {if3 (data3 ==xx and data2 ==xx and data3 == xx} {console.log ('its ok');}});});});

The problem is that the three requests will be one after the other, I want to create 3 at a time, and then for example, call my position like this (do not work for you Understand what I want):

  redis.get ('data1', function (mistake, data1) {var data1 = data1;}); Redis.get ('data2', function (mistake, data2) {var data2 = data2;}); Redis.get ('data3', function (mistake, data 3) {var data3 = data3;}); // When the 3 operation was completed (data 3 == xx & amp; data2 ==xx and data3 == xx} {console.log ('its ok'); }  

Thank you in advance

as well

  var m = redis.multi (); M.get ('data1'); M.get ('data2'); M.get ('data3'); M.exec (function (error, result) {console.log (result);});  

No comments:

Post a Comment