Redis Pub/Sub: UNSUBSCRIBE
Redis UNSUBSCRIBE Command
Redis UNSUBSCRIBE command is used to unsubscribe the client from the given channels, or from all of them if none is given.
Here are some common uses and scenarios for the "UNSUBSCRIBE" command:
- Channel Unsubscription: Unsubscribes the client from one or more specified channels, stopping the receipt of messages from those channels.
- Resource Management: Helps in managing and freeing up resources by ending subscriptions to channels that are no longer needed.
- Dynamic Subscription Control: Allows clients to dynamically manage their subscriptions based on changing requirements or conditions.
- Performance Optimization: Reduces unnecessary message processing and network traffic by stopping subscriptions to unused channels.
Syntax:
UNSUBSCRIBE channel [channel ...]
Available since
2.0.0.
Return Value
Array reply.
Return Value Type
Array
Example: Redis UNSUBSCRIBE
redis 127.0.0.1:6379> UNSUBSCRIBE mychannel 1) "unsubscribe" 2) "a" 3) (integer) 0
Previous:
SUBSCRIBE
Next:
Redis Transactions DISCARD
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/redis/redis-unsubscribe.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics