Key(键) String(字符串) Hash(哈希表) List(列表) Set(集合) SortedSet(有序集合) HyperLogLog GEO(地理位置) Pub/Sub(发布/订阅) Transaction(事务) Script(脚本) Connection(连接) Server(服务器)

发布于 2015-09-04 08:46:53 | 374 次阅读 | 评论: 0 | 来源: 网络整理

PUBLISH channel message

将信息 message 发送到指定的频道 channel

  • 可用版本:
  • >= 2.0.0
  • 时间复杂度:
  • O(N+M),其中 N 是频道 channel 的订阅者数量,而 M 则是使用模式订阅(subscribed patterns)的客户端的数量。
  • 返回值:
  • 接收到信息 message 的订阅者数量。
# 对没有订阅者的频道发送信息

redis> publish bad_channel "can any body hear me?"
(integer) 0


# 向有一个订阅者的频道发送信息

redis> publish msg "good morning"
(integer) 1


# 向有多个订阅者的频道发送信息

redis> publish chat_room "hello~ everyone"
(integer) 3
最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务