I have the feeling this might be really dumb. I am trying to obtain the
value of a list's length from redis.
It is returning correctly inside the anonymous function (if I console.log
it), I just can't for the life of me seem to access outside of that
function.
Here I have set a local variable - len - and tried to assign a value for it
inside the function.
I wouldn't expect it to work like this, because I should set a global
variable len instead.
The strange thing is that neither approach works. Even if the global
variable did the trick, it seems remiss to be using a global variable for
something so trivial.
Any ideas on a solution? Here is my code:
var len = 0
redis.llen("chatRecord", function (err, length) {
log('length from llen is: ' + length)
len = length
});
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/5470046c-d492-4810-8d7f-855e88e97ce0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.