YouTip LogoYouTip

Pub Sub Psubscribe

Redis Psubscribe Command

Redis Psubscribe Command

--

Redis Tutorial

Redis Tutorial Redis Introduction Redis Installation Redis Configuration Redis Data Types

Redis Commands

Redis Commands Redis Keys Redis Strings Redis Hashes Redis Lists Redis Sets Redis Sorted Sets Redis HyperLogLog Redis Publish/Subscribe Redis Transactions Redis Scripting Redis Connection Redis Server Redis GEO Redis Stream

Advanced Redis Tutorial

Redis Backup and Recovery Redis Security Redis Performance Testing Redis Client Connection Redis Pipelining Redis Partitioning Java with Redis PHP with Redis Redis Publish/Subscribe Redis Psubscribe Command

Redis Psubscribe Command

Image 3Redis Publish/Subscribe

The Redis Psubscribe command subscribes to one or more channels matching the given patterns.

Each pattern uses * as a wildcard, for example, it* matches all channels starting with it (it.news, it.blog, it.tweets, etc.). news.* matches all channels starting with news. (news.it, news.global.today, etc.), and so on.

Syntax

The basic syntax of the redis Psubscribe command is as follows:

redis 127.0.0.1:6379> PSUBSCRIBE pattern [pattern ...]

Available Versions

>= 2.0.0

Return Value

The received messages.

Example

redis 127.0.0.1:6379> PSUBSCRIBE mychannel
Reading messages... (press Ctrl-C to quit)
1) "psubscribe"
2) "mychannel"
3) (integer) 1
Image 4Redis Publish/Subscribe Redis Publish/Subscribe Redis Psubscribe Command

ByteDance Coding Plan supports mainstream large models such as Doubao, GLM, DeepSeek, Kimi, MiniMax, etc., directly supplied by the official, stable and reliable. Configuration Guide Β₯9.9/month Subscribe Now

← Server BgrewriteaofRedis Server β†’