Bruno Oliveira Bruno Oliveira - 1 year ago 100
Node.js Question

How to send ZRank in IOREDIS

I am new to Nodejs and I am using ioredis to send redis commands to my cluster.

I couldn't find any ioredis sample of how to use the zrank command in ioredis, except the basic 'get' and 'set' commands.

I know ioredis implemments it, but the parameters and callbacks is a mistery for me.

Thanks and sorry if the question might be duplicated.

Answer Source

It would be something like this. The key and the member name. If the member is not found in the key, null is returned (and other rules as in the docs here)

//redis.client established elsewhere (server startup)

redis.client.zrank( keyOfSortedSet, memberOfSortedSet )
  console.log('the rank of ' + memberOfSortedSet + ' was ' + rank );
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download