Skip to content

ZRANGE.WATCH

ZRANGE.WATCH key start stop [BYSCORE | BYRANK]

ZRANGE.WATCH creates a query subscription over the ZRANGE command. The client invoking the command will receive the output of the ZRANGE command (not just the notification) whenever the value against the key is updated.

You can update the key in any other client. The ZRANGE.WATCH client will receive the updated value.

client1:7379> ZADD users 10 alice 20 bob 30 charlie
OK 3
client1:7379> ZRANGE.WATCH users 1 5
entered the watch mode for ZRANGE.WATCH users
client2:7379> ZADD users 40 daniel
OK 1
client1:7379> ...
entered the watch mode for ZRANGE.WATCH users
OK [fingerprint=1007898011883907067]
1) 10, alice
2) 20, bob
3) 30, charlie
4) 40, daniel