开发者

Implement ZMOVE with WATCH in Redis

The Redis documentation on transactions gives an example of how to implement 开发者_开发百科ZPOP. How do I implement ZMOVE for Redis sorted sets (analagous to SMOVE)?


Is this right? .. to move an element, ele, from sorted set z1 to z2 and give it SCORE 1, i.e.:

ZMOVE z1 z2 1 ele

WATCH z1 z2
MULTI
ZREM z1 ele
ZADD z2 1 ele
EXEC

I will set the SCORE to be the current time, but I just used 1 here for simplicity.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜