Skip to content

Instantly share code, notes, and snippets.

@luin
Created December 5, 2012 07:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luin/4213629 to your computer and use it in GitHub Desktop.
Save luin/4213629 to your computer and use it in GitHub Desktop.
async demo
function some_fun(req,res,next) {
asyc.waterfall([
function getNewObjectID(callback) {
redis.incr('next_id', callback);
},
function storeObject(r, callback) {
var object = {id:r, now:Date.now()};
redis.set('key', object, callback);
},
function sendResponse(_, callback) {
res.send([1,'ok']);
}
], next);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment