File: chat-websocket/node_modules/socket.io/node_modules/redis/examples/multi2.js

Recommend this page to a friend!
  Classes of Igor Escobar   Terminal Crossword   chat-websocket/node_modules/socket.io/node_modules/redis/examples/multi2.js   Download  
File: chat-websocket/node_modules/socket.io/node_modules/redis/examples/multi2.js
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Terminal Crossword
Generate a crosswords board on a text console
Author: By
Last change:
Date: 2 years ago
Size: 776 bytes
 

Contents

Class file image Download
var redis = require("redis"), client = redis.createClient(), multi; // start a separate command queue for multi multi = client.multi(); multi.incr("incr thing", redis.print); multi.incr("incr other thing", redis.print); // runs immediately client.mset("incr thing", 100, "incr other thing", 1, redis.print); // drains multi queue and runs atomically multi.exec(function (err, replies) { console.log(replies); // 101, 2 }); // you can re-run the same transaction if you like multi.exec(function (err, replies) { console.log(replies); // 102, 3 client.quit(); }); client.multi([ ["mget", "multifoo", "multibar", redis.print], ["incr", "multifoo"], ["incr", "multibar"] ]).exec(function (err, replies) { console.log(replies.toString()); });