Redis publish/subscribe: see what channels are currently subscribed to

后端 未结 5 1645
Happy的楠姐
Happy的楠姐 2021-02-05 14:37

I am currently interested in seeing what channels are subscribed to in a Redis pub/sub application I have. When a client connects to our server, we register them to a channel th

5条回答
  •  醉梦人生
    2021-02-05 14:44

    As of Redis 2.8 you can do:

    PUBSUB CHANNELS [pattern]
    

    The PUBSUB CHANNELS command has O(N) complexity, where N is the number of active channels.

    So in your case:

    redis-cli PUBSUB CHANNELS user*
    

    would give you want you want.

提交回复
热议问题