New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to get the "get" command real value isn't a 'true' #475
Comments
Hi @yuany -- this is a traditional Node.js library in that you provide callbacks to execute asynchronously when the results are ready. I.e.: client.get("foo", function (error, value) { /* ... */ }) This is a result of the way that Node.js works, IO operations are done asynchronously. The return value for these functions is not the value. |
Thanks, @brycebaril I have tried the function like this: var result = client.get("foo", function (error, value) { return value}); |
Hi @yuany -- That's not how node works when it is doing IO. The callback provides a context to execute when the result is available. All other code that doesn't depend on the IO will run while the IO operation is queued, executed, and the reply is waited for. Here's a good place to learn more about how it works: https://github.com/maxogden/art-of-node#callbacks E.g.
|
Thanks, @brycebaril I am clear now , the issue that the executing of callback function is asynchronous. |
how to get the "get" command real value isn't a 'true'?
The text was updated successfully, but these errors were encountered: