function handler(yes, no) {
return function (err, data) {
if (data) {
yes(err, data);
}
else {
no(err, data);
}
}
}
function get() {
function done(err, data) {
// do something with data
}
function db() {
asynchronousDb.query("SELECT * fomr something where id = 3244", done);
}
asynchronousCache.get("id:3244", handler(done, db));
}