0

all

I am studying node_redis, in examples/simple.js, there is the following code:

1    client.hset("hash key", "hashtest 1", "some value", redis.print);
2    client.hset(["hash key", "hashtest 2", "some other value"], redis.print);
3    client.hkeys("hash key", function (err, replies) {
4        console.log(replies.length + " replies:");
5        replies.forEach(function (reply, i) {
...

I am confused that :

why line 3 has two parameters "(err, replies)" , does the designer define how many parameters?

or would you like to guide me what book or other something I should read to understand them? Thank you in advance!

BEST REGARDS

PengCZ

abelard2008
  • 1,984
  • 1
  • 20
  • 35

1 Answers1

2

function (error, data..) is de-facto standard for arguments of callbacks in node.js.

If operation completes successfully, error is null, and replies is array with hash keys. If there was error, error contains details and replies are not filled.

Is that what you are asking about?

m6k
  • 678
  • 5
  • 14