ZRANGE.UNWATCH
The ZRANGE.UNWATCH
command is a feature to stop receiving updates on a sorted set.
Protocol Support
Protocol | Supported |
---|---|
TCP-RESP | ✅ |
HTTP | ❌ |
WebSocket | ❌ |
Syntax
Parameters
Parameter | Description | Type | Required |
---|---|---|---|
fingerprint | Fingerprint returned as part of the zrange.watch query | String | Yes |
Return Value
Condition | Return Value |
---|---|
Command is successful | OK |
Behavior
- The client unsubscribes from the sorted set specified with the key.
Errors
Missing fingerprint
- Error Message:
(error) ERROR wrong number of arguments for 'zrange.unwatch' command
- Occurs if no fingerprint is provided.
- Error Message:
Example Usage
Basic Usage
Let’s explore a practical example of using the ZRANGE.WATCH
command to create a real-time submission leaderboard for a game match.
When the sorted set is updated using following set of commands from another client:
The client will receive a message similar to the following:
To stop receiving updates on the key, use the ZRANGE.UNWATCH
command.
Notes
Use the ZRANGE.WATCH
command to subscribe to a key. This will allow the client to receive updates on the sorted set. Please refer to
the ZRANGE.WATCH command documentation for more information.
Related commands
following are the related commands to ZRANGE.UNWATCH
: