Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Insert result of ZRANGEBYSCORE into a set

Tags:

redis

I'm trying to figure out how i can take the result of a ZRANGEBYSCORE command on a sorted set and save the result as a new set in redis, I do not want the data to come back to the client. I know could read the result in the client and then push the result as a new set, but i dont want the data to transfer back and forth between the client and the server.

Basically i have a sorted set 'A' and a regular set 'B'. I want to filter the values in the sorted set by running ZRANGEBYSCORE on 'A' and then intersect the result with 'B'. Hope that makes sense. Wondering how i can do that

like image 403
newbie Avatar asked Nov 30 '11 00:11

newbie


1 Answers

Unfortunately you can't do that. You may want to try using the unstable version that allows Lua scripting (which is quite stable at this time) and you could do it with a simple Lua script.

like image 103
seppo0010 Avatar answered Jan 01 '23 20:01

seppo0010