• 使用redis的发布订阅


    redis的发布订阅,是消息中间件的一种,是进程间的一种消息通讯模式: 发布者(pub)发送消息,接收者(sub)接受消息

    案例:

    1.首先接收者订阅多个消息

    接收者:subscribe  a1  a2  a3

    发送者发送消息  则接收者自动接收

    发送者:publish a1 “hello world”

    此时接收者自动显示:“hello world”

    /*****************************************************************/

    2.接收者使用通配符 psubscribe  模糊接受订阅多个消息

    接收者:psubscribe news*

    发送者发送news开头的消息   接收者自动接收

    发送者 publish news123 "hello  redis"

    此时接收者自动显示:“hello redis”

  • 相关阅读:
    IOS
    XCode
    Android Studio
    Android Studio
    Cordova
    Delphi
    Cordova
    Delphi
    JQuery Mobile
    twitter ads_campaign management(图示)
  • 原文地址:https://www.cnblogs.com/hxd9588/p/13656223.html
Copyright © 2020-2023  润新知