node-redis icon indicating copy to clipboard operation
node-redis copied to clipboard

problem using Bitop

Open jimsproject opened this issue 13 years ago • 1 comments

Dear all,

i have several key ex: uniq:1..uniq:n then i want to do bitop to all key. bitop or uniq:1 uniq:2 uniq:3 uniq:4 ... uniq:n note :n value is dynamic.

how i can implement this in node redis?

thank you

jimmy

jimsproject avatar Nov 13 '13 14:11 jimsproject

var c = require('redis').createClient()
c.setbit('uniq:1', 7, 1)
c.setbit('uniq:2', 6, 1)
c.setbit('uniq:3', 7, 1)
c.bitop('or', 'uniq:or', 'uniq:1', 'uniq:2', 'uniq:3')

If you need the list of keys to be truly dynamic, you'll probably need to use send_command

c.send_command('bitop', ['or', 'uniq:or', 'uniq:1', 'uniq:2', 'uniq:3'])

brycebaril avatar Nov 23 '13 18:11 brycebaril