本文内容为 http://www.redis.io/commands/unsubscribe 的翻译、注解、例子扩充及其它修改。感谢 Redis 作者 Antirez 为开源社区作出的贡献,本文保证最新、最准、最全以表示对其的敬意。欢迎留言纠错、提示更新或支持。
UNSUBSCRIBE [channel [channel ...]]

从给定的频道(Channel)中退订(Unsubscribe)当前客户端(Client)。如果未指定频道,将会全部退订。

Unsubscribes the client from the given channels, or from all of them if none is given.

如果未提供任何频道,当前客户端(程序)将会取消订阅之前订阅的所有频道。在这种情况下,对每一个被取消订阅的频道,都会有一条消息发送给客户端。

When no channels are specified, the client is unsubscribed from all the previously subscribed channels. In this case, a message for every unsubscribed channel will be sent to the client.
  • 版本支持

    2.0.0+

    时间复杂度(Time complexity)

    O(N)

    O(N) where N is the number of clients already subscribed to a channel.