Get the App
SLTechnology News&Howtos  ›  Network Security  › 

Introduction to redis publish and subscribe function

Shulou Source: shulou.com Published: 2022-06-01 04:02:27 10月01日 Update

Redis publish and subscribe function (publish/subscribe):

Channels: message queuing

Subscribe: subscribe to one or more queues

> help subscribe # View subscribe help

Example: subscribe to news channel

> subscribe news

Note: you can subscribe to multiple channels at the same time

Publish: send messages to the channel

> help @ pubsub # View publish help

Example: send a message to the news channel

> publish new hello

Psubscribe: pattern subscription-- > you can subscribe to more than one channel at a time using regular expressions

> psubscribe "new.i [to]"

Publish: send messages to the channel

> help @ pubsub # View publish help

Example: send a message to the news channel

> publish new hello

Unsubscribe: unsubscribe from previously subscribed channels

Tags: Channels subscriptions messages multiple help queues functions simultaneously patterns regularities expressions Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Shulou Tech Info Linux MariaDB OPPO Reno