Skip to content

ZRANK.WATCH

ZRANK.WATCH key

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

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

client1:7379> ZADD users 10 alice 20 bob 30 charlie
OK 3
client1:7379> ZRANK.WATCH users bob
entered the watch mode for ZRANK.WATCH users
client2:7379> ZADD users 10 bob
OK 0
client2:7379> ZADD users 100 alice
OK 0
client1:7379> ...
entered the watch mode for ZRANK.WATCH users
OK [fingerprint=3262833422269415227] 2) 10, bob
OK [fingerprint=3262833422269415227] 1) 10, bob