#### 發布訂閱
[TOC]
###### SUBSCRIBE channel [channel ...]
起始版本:2.0.0
時間復雜度:O(N) where N is the number of channels to subscribe to.
> 訂閱給指定頻道的信息。
一旦客戶端進入訂閱狀態,客戶端就只可接受訂閱相關的命令SUBSCRIBE、PSUBSCRIBE、UNSUBSCRIBE和PUNSUBSCRIBE除了這些命令,其他命令一律失效。
###### PSUBSCRIBE pattern [pattern ...]
起始版本:2.0.0
時間復雜度:O(N) where N is the number of patterns the client is already subscribed to.
> 訂閱給定的模式(patterns)。
支持的模式(patterns)有:
~~~
h?llo subscribes to hello, hallo and hxllo
h*llo subscribes to hllo and heeeello
h[ae]llo subscribes to hello and hallo, but not hillo
~~~
如果想輸入普通的字符,可以在前面添加\
###### PUBLISH channel message
起始版本:2.0.0
時間復雜度:O(N+M) where N is the number of clients subscribed to the receiving channel and M is the total number of subscribed patterns (by any client).
> 將信息 message 發送到指定的頻道 channel
返回值
integer-reply: 收到消息的客戶端數量。
- 目錄
- 安裝擴展
- 在 Windows 上安裝 PHP 擴展
- 測試Redis擴展函數
- 教程
- 簡介
- Redis 安裝
- Redis 配置
- 運行
- 測試
- 書籍
- 《Redis開發與運維》
- 《Redis入門指南》
- 《Redis實戰》
- 《當 Redis 遇上 ThinkPHP5》
- 參考站點
- 下載
- 命令參考
- 管理工具
- 視頻
- 云數據庫 Redis 版使用教程
- Redis 深入之道
- Redis高可用教程
- Redis入門
- NoSQL概述
- Redis概述
- Redis安裝
- Jedis入門
- PHP命令
- PHP中利用Redis管道加快執行
- Hash操作
- Set操作
- Gearman
- MySQL - Redis配合使用方案
- 應用場景
- 緩存應用
- Redis實現簡單的條件查詢功能
- 獲取網站中點擊量最高的前n篇文章
- 顯示最新的項目列表
- 排行榜相關
- 設計技巧
- SortedSets
- List列表
- 消息隊列
- 最新文章
- Set集合
- 共同好友
- 獨立 IP
- Linux教程
- 常用命令
- 哈希命令
- 字符串
- 集合
- 有序集合
- Redis 有序集合命令
- 有序集合命令(中)
- 發布訂閱
- 用例
- 列表
- Lindex
- Ltrim
- Rpush
- Lset
- Llen
- Lpush
- 信息
- info memory
- 安裝
- 數據類型
- Redis管道(pipeline)
- Memory Command
- 阿里云Redis
- 架構
- 4.0版本
- Redis 4.0 新功能介紹
- Redis Desktop Manager
- 創建hash列表數據
- Lua: 給 Redis 用戶的入門指導
- Lua入門
- 樂觀鎖介紹
- 悲觀鎖介紹
- 臟數據
- Redis核心概念
- Redis事務
- Lua
- 在Redis中使用lua腳本
- php-redis
- mysql緩存服務器
- redis setnx 實現分布式鎖和單機鎖
- 為什么分布式一定要有Redis?