Forked from hmpmarketing/gist:8c1891f81d316c8465146db3a0b7b723
Last active
January 5, 2018 19:30
-
-
Save jkantr/1e21d8d79df4c2a5520d9cfc9c239b53 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// do this | |
cache.remember('key1', 600, function() { | |
return mysql.MobileAction.findOne({ where: {action_id: req.query.D} }) | |
}).then((val) => { | |
console.log('set: ', val); | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// don't do this | |
mysql.MobileAction.findOne({ where: {action_id: req.query.D} }).then(function(action) { | |
cache.remember('key1', 600, function() { | |
return Promise.resolve(action); | |
}).then((val) => { | |
console.log('set: ', val); | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment