Skip to content

PFCOUNT.UNWATCH

The PFCOUNT.UNWATCH command is a feature to stop receiving updates on a HyperLogLog.

Protocol Support

ProtocolSupported
TCP-RESP
HTTP
WebSocket

Syntax

Terminal window
PFCOUNT.UNWATCH <fingerprint>

Parameters

ParameterDescriptionTypeRequired
fingerprintFingerprint returned as part of the PFCOUNT.WATCH queryStringYes

Return Value

ConditionReturn Value
Command is successfulOK

Behavior

  • The client unsubscribes from the HyperLogLog key specified by the fingerprint.

Errors

  1. Missing fingerprint
    • Error Message: (error) ERROR wrong number of arguments for 'pfcount.unwatch' command
    • Occurs if no fingerprint is provided.

Example Usage

Basic Usage

Here’s an example of using the PFCOUNT.WATCH and PFCOUNT.UNWATCH commands to monitor and stop monitoring the cardinality of a HyperLogLog.

Terminal window
127.0.0.1:7379> PFCOUNT.WATCH users:hll
Press Ctrl+C to exit watch mode.

When the HyperLogLog is updated using the following commands from another client:

Terminal window
127.0.0.1:7379> PFADD users:hll "user1"
OK
127.0.0.1:7379> PFADD users:hll "user2"
OK
127.0.0.1:7379> PFADD users:hll "user3"
OK

The subscribing client will receive messages similar to the following:

Terminal window
127.0.0.1:7379> PFCOUNT.WATCH users:hll
Press Ctrl+C to exit watch mode.
1
2
3

To stop receiving updates on the key, use the PFCOUNT.UNWATCH command:

Terminal window
127.0.0.1:7379> PFCOUNT.UNWATCH 1298365423
OK

Notes

Use the PFCOUNT.WATCH command to subscribe to a HyperLogLog key and receive real-time updates. Refer to the PFCOUNT.WATCH command documentation for more details.

The following commands are related to PFCOUNT.UNWATCH: