Skip to content

Instantly share code, notes, and snippets.

@DTrejo
Created April 27, 2012 20:12
Show Gist options
  • Save DTrejo/2512553 to your computer and use it in GitHub Desktop.
Save DTrejo/2512553 to your computer and use it in GitHub Desktop.
var redis = require("../index");
var async = require("async");
// Set this to truthy to see the wire protocol and other debugging info
redis.debug_mode = process.argv[2];
client1 = redis.createClient();
client2 = redis.createClient();
multi1 = client1.multi();
multi2 = client2.multi();
async.series([
function(callback) {
client1.flushdb(callback);
},
function(callback) {
client1.watch('a1',callback);
},
function(callback) {
client2.watch('a1',callback);
},
function(callback) {
multi1.set('a1','b1');
multi2.set('a1','b2');
callback();
},
function(callback) {
multi1.exec(function(err,result) {
console.log();
console.log('multi1 returned err:'+err+' result:'+JSON.stringify(result));
callback();
});
},
function(callback) {
multi2.exec(function(err,result) {
console.log(JSON.stringify(result));
console.log('multi2 returned err:'+err+' result:'+JSON.stringify(result));
callback();
});
}
], function() {
console.log('==done==');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment