Closed ngetha closed 9 years ago
try
var resp = wait.forMethod(client,"get", sid);
console.log(resp);
This doesn't work, why?
var $r = require('heroku-redis-client').createClient(),
$wait = require('wait.for');
module.exports = function(id) {
var n = parseInt($wait.for($r.hget, 'counter:item', id));
return n || 0;
Gives this error:
TypeError: Object #<Object> has no method 'send_command'
at RedisClient.(anonymous function) (/Development/node_modules/heroku-redis-client/node_modules/redis/index.js:959:25)
at Object.Wait.applyAndWait (/Development/node_modules/wait.for/waitfor.js:45:12)
at Object.Wait [as for] (/Development/node_modules/wait.for/waitfor.js:61:21)
at Array.module.exports [as 0] (/Development/my.js...)
Oh, I am sorry. After some testing I've figured it out.
Correct code:
var $r = require('heroku-redis-client').createClient(),
$wait = require('wait.for');
module.exports = function(id) {
var n = parseInt($wait.forMethod($r, 'hget', 'counter:item', id));
return n || 0;
Hi
I need to send a command to redis and wait for the response while responding to a request in Express.
Code Below - Error is 'Error Error: ERR wrong number of arguments for 'get' command'