• 周四. 12月 1st, 2022

5G编程聚合网

5G时代下一个聚合的编程学习网

热门标签

通俗易懂的redis发布订阅原理实现!

[db:作者]

1月 6, 2022

{“type”:”doc”,”content”:[{“type”:”heading”,”attrs”:{“align”:null,”level”:2},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}}],”text”:”前言”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”text”:”可能小伙伴的工作年限大部分已经超过三年甚至四年五年,不知道是否有一种危机感,我们写了那么多的需求代码没有20w行也有个10w行了吧,但是出去找工作的时候不是”,”attrs”:{}},{“type”:”codeinline”,”content”:[{“type”:”text”,”text”:”笔试被pass”,”attrs”:{}}],”marks”:[{“type”:”color”,”attrs”:{“color”:”#9654B5″,”name”:”user”}}],”attrs”:{}},{“type”:”text”,”text”:”掉就是”,”attrs”:{}},{“type”:”codeinline”,”content”:[{“type”:”text”,”text”:”面试被pass”,”attrs”:{}}],”marks”:[{“type”:”color”,”attrs”:{“color”:”#9654B5″,”name”:”user”}}],”attrs”:{}},{“type”:”text”,”text”:”,你会发现好多你只是知道但是回答不上来。这个时候你才知道去补习知识点,其实这种做法对自身发展不太友好的。”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”text”:”我去年疫情期间,在大家都不敢跳槽季节我义无反顾选择跳槽,进入大家说的bat一线大厂。最近跟之前老东家的同事聊了聊技术栈、家常;说是面试了很多两三年经验开发者基础太薄弱等等。”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null}},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”text”:”所以我也从4月底跟随之前的朋友一起开始了写作之路,我基本上是以面对对象是小白讲解方式开展自己的写作模式,期间也有小伙伴让我写高级点的 ,但是确实不敢在那么大佬面前造次;还是坚持从0到1的”,”attrs”:{}},{“type”:”codeinline”,”content”:[{“type”:”text”,”text”:”redis”,”attrs”:{}}],”marks”:[{“type”:”color”,”attrs”:{“color”:”#9654B5″,”name”:”user”}}],”attrs”:{}},{“type”:”text”,”text”:”讲解之路,希望能得到小伙伴的支持。”,”attrs”:{}}]},{“type”:”bulletedlist”,”content”:[{“type”:”listitem”,”attrs”:{“listStyle”:null},”content”:[{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”link”,”attrs”:{“href”:”https://xie.infoq.cn/article/14d38f0c2894a835feb4598a1″,”title”:””,”type”:null},”content”:[{“type”:”text”,”text”:”我终于弄清楚了redis数据结构之string应用场景”,”attrs”:{}}]}]}]},{“type”:”listitem”,”attrs”:{“listStyle”:null},”content”:[{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”link”,”attrs”:{“href”:”https://xie.infoq.cn/article/64a487d0d84c9b9c2c25dc5ff”,”title”:””,”type”:null},”content”:[{“type”:”text”,”text”:”面试系列-2 redis列表场景分析实践”,”attrs”:{}}]}]}]},{“type”:”listitem”,”attrs”:{“listStyle”:null},”content”:[{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”link”,”attrs”:{“href”:”https://xie.infoq.cn/article/c9f53febb066706789ad4801f”,”title”:””,”type”:null},”content”:[{“type”:”text”,”text”:”面试系列-3 限流场景实践”,”attrs”:{}}]}]}]},{“type”:”listitem”,”attrs”:{“listStyle”:null},”content”:[{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”link”,”attrs”:{“href”:”https://xie.infoq.cn/article/87ddc90a76a3759da3ba46de3″,”title”:””,”type”:null},”content”:[{“type”:”text”,”text”:”面试系列-4 hash应用场景分析实践”,”attrs”:{}}]}]}]},{“type”:”listitem”,”attrs”:{“listStyle”:null},”content”:[{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”link”,”attrs”:{“href”:”https://xie.infoq.cn/article/9b0827c018443828d2f0ebedf”,”title”:null,”type”:null},”content”:[{“type”:”text”,”text”:”面试官嘲笑我,这你都不会?”,”attrs”:{}}],”marks”:[{“type”:”strong”}]}]}]}],”attrs”:{}},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”text”:”大部分是根据自己以往的面试和同事交流得出来的,有不对的地方还希望小伙伴们多多指正。”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”text”:”那么开启我们新的一轮面试知识点之旅…..”,”attrs”:{}}]},{“type”:”heading”,”attrs”:{“align”:null,”level”:2},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}}],”text”:”正文”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”text”:”今天要聊的知识点是redis的订阅发布功能,虽然说现在大厂都使用了”,”attrs”:{}},{“type”:”codeinline”,”content”:[{“type”:”text”,”text”:”kafka”,”attrs”:{}}],”marks”:[{“type”:”color”,”attrs”:{“color”:”#9654B5″,”name”:”user”}}],”attrs”:{}},{“type”:”text”,”text”:”、”,”attrs”:{}},{“type”:”codeinline”,”content”:[{“type”:”text”,”text”:”RabbitMQ”,”attrs”:{}}],”marks”:[{“type”:”color”,”attrs”:{“color”:”#9654B5″,”name”:”user”}}],”attrs”:{}},{“type”:”text”,”text”:”、”,”attrs”:{}},{“type”:”codeinline”,”content”:[{“type”:”text”,”text”:”ActiveMQ”,”attrs”:{}}],”marks”:[{“type”:”color”,”attrs”:{“color”:”#9654B5″,”name”:”user”}}],”attrs”:{}},{“type”:”text”,”text”:”, “,”attrs”:{}},{“type”:”codeinline”,”content”:[{“type”:”text”,”text”:”RocketMQ”,”attrs”:{}}],”marks”:[{“type”:”color”,”attrs”:{“color”:”#9654B5″,”name”:”user”}}],”attrs”:{}},{“type”:”text”,”text”:”;这几种我大概用了三种,其实实现原理和内部使用方式都大同小异。为什么讲redis的呢?因为轻量、直接使用,而上面几种适合大数据量,对数据准确性要求高的场景,作为第三方组件,在小公司考虑到成本人力是不是太有好的,存在更多风险。”,”attrs”:{}}]},{“type”:”heading”,”attrs”:{“align”:null,”level”:3},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}}],”text”:”为什么要用发布订阅”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”text”:”其实理论上我们之前的列表场景使用双端链表就可以实现发布与订阅功能,但是这种通过链表来实现的发布与订阅功能有两个局限性:”,”attrs”:{}}]},{“type”:”bulletedlist”,”content”:[{“type”:”listitem”,”attrs”:{“listStyle”:null},”content”:[{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”strong”,”attrs”:{}}],”text”:”1、基于链表实现的消息队列,不能支持一对多的消息分发。”,”attrs”:{}}]}]},{“type”:”listitem”,”attrs”:{“listStyle”:null},”content”:[{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”strong”,”attrs”:{}}],”text”:”2、假如生产者生成的速率远远大于消费者消费消息的速率,可能会导致未消费消息占用大量的内存(需要开启足够多的消费进程)。”,”attrs”:{}}]}]}],”attrs”:{}},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”text”:”我画两张图进行对比,小伙伴们一眼就能看出来区别:”,”attrs”:{}}]},{“type”:”image”,”attrs”:{“src”:”https://static001.geekbang.org/infoq/56/560ca9c4e6d8669f0c546ef9b4452a46.png”,”alt”:null,”title”:””,”style”:[{“key”:”width”,”value”:”75%”},{“key”:”bordertype”,”value”:”none”}],”href”:””,”fromPaste”:true,”pastePass”:true}},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#595959″,”name”:”user”}}],”text”:”普通消息队列结构图”,”attrs”:{}}]},{“type”:”image”,”attrs”:{“src”:”https://static001.geekbang.org/infoq/45/459a3f0903fd32bb12eeb7a999724123.png”,”alt”:null,”title”:””,”style”:[{“key”:”width”,”value”:”75%”},{“key”:”bordertype”,”value”:”none”}],”href”:””,”fromPaste”:false,”pastePass”:false}},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null}},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#595959″,”name”:”user”}}],”text”:”PubSub结构图”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#595959″,”name”:”user”}}],”text”:”从上面的图中可以看出普通消息队列:只能有一个多个消费者去消费,却不能将消息分发给其他消费者;redis订阅发布:生产者生产完消息通过频道分发消息给订阅该频道的消费者,这样就可以较少队列数据的积攒,导致内存暴增。”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#595959″,”name”:”user”}}],”text”:”所以为了解决这两个局限性,Redis当中选择了通过其他命令来实现发布与订阅模式。”,”attrs”:{}}]},{“type”:”heading”,”attrs”:{“align”:null,”level”:3},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}}],”text”:”redis订阅发布的基本命令”,”attrs”:{}}]},{“type”:”codeblock”,”attrs”:{“lang”:”shell”},”content”:[{“type”:”text”,”text”:”psubscribe指令: psubscribe pattern [pattern …] 订阅一个或多个符合给定模式的频道;时间复杂度O(n),n是订阅的模式的数量。\n\n注意点:每个模式以 * 作为匹配符;例如 mumu*匹配所有以 mumu 开头的频道:mumu.juejin、mumu.zhihu、mumu.csdn\n\npublist指令:publish channel message 把信息message发送到指定的频道channel;时间复杂度O(n+m),n是频道channel的订阅者数量,m则是使用模式订阅(subscribed patterns)的客户端的数量。\n\n注意点:结果集返回是接收到message的订阅者数量,没有订阅者返回0。\n\npubsub指令:pubsub channels [argument [argument …]] 查看订阅与发布系统状态;时间复杂度O(n),n为活跃频道的数量(对于长度较短的频道和模式来说,将进行模式匹配的复杂度视为常数)。\n\n注意:列出当前的活跃频道(指的是那些至少有一个订阅者的频道, 订阅模式的客户端不计算在内),返回一个活跃频道组成的列表。\n\npunsubscribe指令:punsubscribe [pattern [pattern …]] 退订所有给定模式的频道;时间复杂度O(n+m),其中n是客户端已订阅的模式的数量, m则是系统中所有客户端订阅的模式的数量。\n\n注意:pattern未指定那么订阅的所有模式都会被退订;否则只会退订指定的订阅的模式\n\nsubscribe指令:subscribe channel [channel …] 订阅给定的一个或多个频道的信息;时间复杂度O(n),其中n是订阅的频道的数量。\n\nunsubscribe指令:unsubscribe channel [channel …] 指退订给定的频道;时间复杂度O(n),其中n是订阅的频道的数量。\n\n注意:若没有指定退订channel,则默认退订所有频道;否则退订指定频道。BSCRIBE 命令订阅的所有频道都会被退订。在这种情况下,命令会返回一个信息,告知客户端所有被退订的频道。\n\n”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”text”:”那么在Redis中的发布与订阅也分为两种类型,一种是”,”attrs”:{}},{“type”:”codeinline”,”content”:[{“type”:”text”,”text”:”基于频道”,”attrs”:{}}],”marks”:[{“type”:”color”,”attrs”:{“color”:”#9654B5″,”name”:”user”}}],”attrs”:{}},{“type”:”text”,”text”:”来实现,一种是”,”attrs”:{}},{“type”:”codeinline”,”content”:[{“type”:”text”,”text”:”基于模式”,”attrs”:{}}],”marks”:[{“type”:”color”,”attrs”:{“color”:”#9654B5″,”name”:”user”}}],”attrs”:{}},{“type”:”text”,”text”:”来实现。”,”attrs”:{}}]},{“type”:”heading”,”attrs”:{“align”:null,”level”:2},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}}],”text”:”基于频道实现讲解”,”attrs”:{}}]},{“type”:”bulletedlist”,”content”:[{“type”:”listitem”,”attrs”:{“listStyle”:null},”content”:[{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”strong”,”attrs”:{}}],”text”:”subscribe channe1 channel2 channel3 … :订阅一个或者多个频道”,”attrs”:{}}]}]},{“type”:”listitem”,”attrs”:{“listStyle”:null},”content”:[{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”strong”,”attrs”:{}}],”text”:”unsubscribe channe1 channel2 channel3 … :退订订阅的指定频道(关闭客户端终端没用,需要命令退订)”,”attrs”:{}}]}]},{“type”:”listitem”,”attrs”:{“listStyle”:null},”content”:[{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”strong”,”attrs”:{}}],”text”:”publish channe1 message:对指定频道发送消息”,”attrs”:{}}]}]},{“type”:”listitem”,”attrs”:{“listStyle”:null},”content”:[{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”strong”,”attrs”:{}}],”text”:”pubsub numsub channel1 channel2:查看指定频道的订阅数”,”attrs”:{}}]}]}],”attrs”:{}},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}},{“type”:”strong”,”attrs”:{}}],”text”:”好记性不如烂笔头,光看不练假把戏:”,”attrs”:{}}]},{“type”:”codeblock”,”attrs”:{“lang”:”shell”},”content”:[{“type”:”text”,”text”:”127.0.0.1:6379> SUBSCRIBE mumu_1 mumu_2\nReading messages… (press Ctrl-C to quit)\n1) \”subscribe\”    — 返回值的类型:显示订阅成功\n2) \”mumu_1\”       — 订阅的频道名字\n3) (integer) 1    — 目前已订阅的频道数量\n\n1) \”subscribe\”\n2) \”mumu_2\”\n3) (integer) 2\n\n1) \”message\”      — 返回值的类型:信息\n2) \”mumu_1\”       — 来源(从那个频道发送过来)\n3) \”\\xe6\\x88\\x91\\xe6\\x98\\xaf\\xe9\\x98\\xbf\\xe6\\xb2\\x90\\xe5\\x95\\x8a\” — 消息内容\n”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null}},{“type”:”image”,”attrs”:{“src”:”https://static001.geekbang.org/infoq/b2/b2d43c3f21e613ea5ad4d121ec426074.png”,”alt”:null,”title”:””,”style”:[{“key”:”width”,”value”:”75%”},{“key”:”bordertype”,”value”:”none”}],”href”:””,”fromPaste”:false,”pastePass”:false}},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null}},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#595959″,”name”:”user”}}],”text”:”订阅频道发消息截图”,”attrs”:{}}]},{“type”:”codeblock”,”attrs”:{“lang”:”shell”},”content”:[{“type”:”text”,”text”:”//获取指定频道的订阅的客户端数量\n127.0.0.1:6379> PUBSUB numsub mumu_1 mumu_2\n1) \”mumu_1\”    — 频道名称\n2) (integer) 1 — 订阅该频道的客户端数量\n3) \”mumu_2\”\n4) (integer) 1\n127.0.0.1:6379> pubsub channels\n1) \”mumu_2\”  — 频道名称\n2) \”mumu_1\”  — 频道名称\n”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null}},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null}},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#595959″,”name”:”user”}}],”text”:”查看订阅数频道信息截图”,”attrs”:{}}]},{“type”:”codeblock”,”attrs”:{“lang”:null},”content”:[{“type”:”text”,”text”:”127.0.0.1:6379> UNSUBSCRIBE mumu_1\n1) \”unsubscribe\”  — 返回值的类型:显示取消订阅成功\n2) \”mumu_1\”       — 取消订阅的频道名字\n3) (integer) 0\n”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}},{“type”:”strong”,”attrs”:{}}],”text”:”我们看下基于频道的实现原理:”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}},{“type”:”strong”,”attrs”:{}}],”text”:”源码路径”,”attrs”:{}},{“type”:”text”,”text”:”:”,”attrs”:{}},{“type”:”codeinline”,”content”:[{“type”:”text”,”text”:”redis-5.0.7/src/server.h”,”attrs”:{}}],”marks”:[{“type”:”color”,”attrs”:{“color”:”#9654B5″,”name”:”user”}}],”attrs”:{}},{“type”:”text”,”text”:”我把redis源码下载到本地查看了;”,”attrs”:{}},{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}},{“type”:”strong”,”attrs”:{}}],”text”:”大约1239行”,”attrs”:{}},{“type”:”text”,”text”:”。”,”attrs”:{}}]},{“type”:”codeblock”,”attrs”:{“lang”:null},”content”:[{“type”:”text”,”text”:”struct redisServer {\n    /* General */\n    pid_t pid;   \n   \n    //省略百十行\n    \n    // 百度翻译  之后意思是: 将频道映射到已订阅客户端的列表(就是保存客户端和订阅的频道信息)\n    dict *pubsub_channels;  /* Map channels to list of subscribed clients */\n}\n”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”codeinline”,”content”:[{“type”:”text”,”text”:”pubsub_channels”,”attrs”:{}}],”marks”:[{“type”:”color”,”attrs”:{“color”:”#9654B5″,”name”:”user”}}],”attrs”:{}},{“type”:”text”,”text”:”定义的属性是一个字典类型,保存着客户端和频道信息,”,”attrs”:{}},{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}},{“type”:”strong”,”attrs”:{}}],”text”:”key值保存的就是频道名”,”attrs”:{}},{“type”:”text”,”text”:”,”,”attrs”:{}},{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}},{“type”:”strong”,”attrs”:{}}],”text”:”value是一个链表”,”attrs”:{}},{“type”:”text”,”text”:”,链表中保存的是”,”attrs”:{}},{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}},{“type”:”strong”,”attrs”:{}}],”text”:”客户端id”,”attrs”:{}},{“type”:”text”,”text”:”。”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null}},{“type”:”image”,”attrs”:{“src”:”https://static001.geekbang.org/infoq/76/76fdd0356ac1d3b296c86019539d0ff8.png”,”alt”:null,”title”:null,”style”:[{“key”:”width”,”value”:”75%”},{“key”:”bordertype”,”value”:”none”}],”href”:null,”fromPaste”:true,”pastePass”:true}},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#595959″,”name”:”user”}}],”text”:”订阅频道内部存储结构”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}},{“type”:”strong”,”attrs”:{}}],”text”:”频道订阅”,”attrs”:{}},{“type”:”text”,”text”:”:订阅频道时先检查字段内部是否存在;不存在则为当前频道创建一个字典且创建一个链表存储客户端id;否则直接将客户端id插入到链表中。”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}},{“type”:”strong”,”attrs”:{}}],”text”:”取消频道订阅”,”attrs”:{}},{“type”:”text”,”text”:”:取消时将客户端id从对应的链表中删除;如果删除之后链表已经是空链表了,则将会把这个频道从字典中删除。”,”attrs”:{}}]},{“type”:”heading”,”attrs”:{“align”:null,”level”:2},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}}],”text”:”基于模式实现讲解”,”attrs”:{}}]},{“type”:”bulletedlist”,”content”:[{“type”:”listitem”,”attrs”:{“listStyle”:null},”content”:[{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”strong”,”attrs”:{}}],”text”:”psubscribe pattern1 pattern2 pattern3 … :订阅一个或多个符合给定模式的频道,每个模式以 * 作为匹配符”,”attrs”:{}}]}]},{“type”:”listitem”,”attrs”:{“listStyle”:null},”content”:[{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”strong”,”attrs”:{}}],”text”:”punsubscribe pattern1 pattern2 pattern3 … :取消模式的订阅(关闭客户端终端没用,需要命令退订)”,”attrs”:{}}]}]},{“type”:”listitem”,”attrs”:{“listStyle”:null},”content”:[{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”strong”,”attrs”:{}}],”text”:”pubsub numpat pattern1 返回订阅模式的数量,返回的不是订阅模式的客户端的数量,而是客户端订阅的所有模式的数量总和。时间复杂度O(1),(具体为啥,请看下面原来解析结构)”,”attrs”:{}}]}]}],”attrs”:{}},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}},{“type”:”strong”,”attrs”:{}}],”text”:”说起时那时快,赶紧动手来实践,眼见为实:”,”attrs”:{}}]},{“type”:”codeblock”,”attrs”:{“lang”:null},”content”:[{“type”:”text”,”text”:”127.0.0.1:6379> PSUBSCRIBE mumu.*\nReading messages… (press Ctrl-C to quit)\n1) \”psubscribe\”       — 返回值的类型:显示订阅成功\n2) \”mumu.*\”           — 订阅的模式\n3) (integer) 1        — 目前已订阅的模式的数量\n\n1) \”pmessage\”         — 返回值的类型:信息\n2) \”mumu.*\”           — 信息匹配的模式\n3) \”mumu.list\”        — 信息本身的目标频道\n4) \”i am a mumu\”      — 信息的内容\n\n”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null}},{“type”:”image”,”attrs”:{“src”:”https://static001.geekbang.org/infoq/97/973360f53d7f2ae25712d0bc01f73cab.png”,”alt”:null,”title”:””,”style”:[{“key”:”width”,”value”:”75%”},{“key”:”bordertype”,”value”:”none”}],”href”:””,”fromPaste”:false,”pastePass”:false}},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null}},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#595959″,”name”:”user”}}],”text”:”模式订阅实践操作图”,”attrs”:{}}]},{“type”:”codeblock”,”attrs”:{“lang”:null},”content”:[{“type”:”text”,”text”:”127.0.0.1:6379> PUNSUBSCRIBE mumu.*\n1) \”punsubscribe\”  — 返回值的类型:显示退订成功\n2) \”mumu.*\”        — 退订的模式\n3) (integer) 1     — 目前已退订的模式的数量\n”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}},{“type”:”strong”,”attrs”:{}}],”text”:”我们看下基于模式的实现原理:”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}},{“type”:”strong”,”attrs”:{}}],”text”:”源码路径”,”attrs”:{}},{“type”:”text”,”text”:”:”,”attrs”:{}},{“type”:”codeinline”,”content”:[{“type”:”text”,”text”:”redis-5.0.7/src/server.h”,”attrs”:{}}],”marks”:[{“type”:”color”,”attrs”:{“color”:”#9654B5″,”name”:”user”}}],”attrs”:{}},{“type”:”text”,”text”:”我把redis源码下载到本地查看了;”,”attrs”:{}},{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}},{“type”:”strong”,”attrs”:{}}],”text”:”大约1240行”,”attrs”:{}},{“type”:”text”,”text”:”。”,”attrs”:{}}]},{“type”:”codeblock”,”attrs”:{“lang”:null},”content”:[{“type”:”text”,”text”:”struct redisServer {\n    /* General */\n    pid_t pid;   \n   \n    //省略百十行\n    \n    // 百度翻译  之后意思是:pubsub订阅的列表信息(大致就是存储订阅模式的信息)\n    list *pubsub_patterns;  /* A list of pubsub_patterns */\n}\n\n// 1303行订阅模式列表结构:\ntypedef struct pubsubPattern {\n    client *client;  — 订阅模式客户端\n    robj *pattern;   — 被订阅的模式\n} pubsubPattern;\n”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null}},{“type”:”image”,”attrs”:{“src”:”https://static001.geekbang.org/infoq/5d/5d2a49bd4e1228ad7de624e77a31a196.png”,”alt”:null,”title”:””,”style”:[{“key”:”width”,”value”:”75%”},{“key”:”bordertype”,”value”:”none”}],”href”:””,”fromPaste”:false,”pastePass”:false}},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null}},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#595959″,”name”:”user”}}],”text”:”模式订阅内部结构图”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}},{“type”:”strong”,”attrs”:{}}],”text”:”模式订阅”,”attrs”:{}},{“type”:”text”,”text”:”:新增一个”,”attrs”:{}},{“type”:”codeinline”,”content”:[{“type”:”text”,”text”:”pubsub_pattern”,”attrs”:{}}],”marks”:[{“type”:”color”,”attrs”:{“color”:”#9654B5″,”name”:”user”}}],”attrs”:{}},{“type”:”text”,”text”:”数据结构添加到链表的最后尾部,同时保存”,”attrs”:{}},{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}},{“type”:”strong”,”attrs”:{}}],”text”:”客户端ID”,”attrs”:{}},{“type”:”text”,”text”:”。”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}},{“type”:”strong”,”attrs”:{}}],”text”:”取消模式订阅”,”attrs”:{}},{“type”:”text”,”text”:”:从当前的链表”,”attrs”:{}},{“type”:”codeinline”,”content”:[{“type”:”text”,”text”:”pubsub_patterns”,”attrs”:{}}],”marks”:[{“type”:”color”,”attrs”:{“color”:”#9654B5″,”name”:”user”}}],”attrs”:{}},{“type”:”text”,”text”:”结构中删除需要取消的模式订阅。”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}},{“type”:”strong”,”attrs”:{}}],”text”:”从上面的一些实际实践结果和结合图形是不是对redis发布订阅进一步了解了呢?”,”attrs”:{}}]},{“type”:”heading”,”attrs”:{“align”:null,”level”:2},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}}],”text”:”那么我们使用redis发布订阅能做什么?”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”text”:”发布订阅(pub/sub)可以这么理解:订阅者(listener)负责订阅频道(channel);发送者(publisher)负责向频道发送二进制的字符串消息,然后频道收到消息时,推送给订阅者。”,”attrs”:{}}]},{“type”:”bulletedlist”,”content”:[{“type”:”listitem”,”attrs”:{“listStyle”:null},”content”:[{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”strong”,”attrs”:{}}],”text”:”电商中,用户下单成功之后向指定频道发送消息,下游业务订阅支付结果这个频道处理自己相关业务逻辑”,”attrs”:{}}]}]},{“type”:”listitem”,”attrs”:{“listStyle”:null},”content”:[{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”strong”,”attrs”:{}}],”text”:”粉丝关注功能”,”attrs”:{}}]}]},{“type”:”listitem”,”attrs”:{“listStyle”:null},”content”:[{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”strong”,”attrs”:{}}],”text”:”文章推送”,”attrs”:{}}]}]},{“type”:”listitem”,”attrs”:{“listStyle”:null},”content”:[{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”strong”,”attrs”:{}}],”text”:”等等等等”,”attrs”:{}}]}]}],”attrs”:{}},{“type”:”heading”,”attrs”:{“align”:null,”level”:3},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}}],”text”:”实践编码”,”attrs”:{}}]},{“type”:”heading”,”attrs”:{“align”:null,”level”:5},”content”:[{“type”:”text”,”text”:”消费者订阅Subscribe.php”,”attrs”:{}}]},{“type”:”codeblock”,”attrs”:{“lang”:”php”},”content”:[{“type”:”text”,”text”:”pconnect(‘127.0.0.1’, 6379);\n    \n    //echo \”Server is running: \” . $redis->ping();\n    //阻塞获取消息\n    while (true) {\n        // 阻塞获取消息 $redis redis的实例  $channel_name 频道名称  $msg 生产者生成的消息体\n        $redis->subscribe($channel_names, function ($redis, $channel_name, $msg) {\n              switch ($channel_name) {\n                case ‘mumu_test1’:\n                    echo \”channel:\”.$channel_name.\”,message:\”.$msg.\”\\n\”;\n                    break;\n                case ‘mumu_test2’:\n\n                    break;\n                case ‘mumu_test3’:\n\n                    break;\n            }\n            if (!$msg) { //当没有收到消息时 就休眠1s钟\n                echo \”channel:\”.$channel_name.\”,message: not appoint channel name\”.\”\\n\”;\n                sleep(1);\n            }\n        });\n        // 本地测试 运行超过10分钟 则自动结束 并关闭redis链接\n        if (time() – $cur_time > 10*60){\n            $redis -> close();\n            break;\n        }\n    }\n} catch (Exception $e) {\n    echo $e->getMessage();\n}\n”,”attrs”:{}}]},{“type”:”heading”,”attrs”:{“align”:null,”level”:5},”content”:[{“type”:”text”,”text”:”生产者发送消息Publish.php”,”attrs”:{}}]},{“type”:”codeblock”,”attrs”:{“lang”:”php”},”content”:[{“type”:”text”,”text”:”connect(‘127.0.0.1’, 6379);\n\n    for ($i = 0; $i  ‘key’ . ($i+1), ‘msg’ => ‘I am li a mu !’);\n\n        $ret = $redis->publish($channel_name, json_encode($data));\n\n        print_r($ret);\n    }\n} catch (Exception $e) {\n    echo $e->getMessage();\n}\n”,”attrs”:{}}]},{“type”:”heading”,”attrs”:{“align”:null,”level”:4},”content”:[{“type”:”text”,”text”:” 执行结果集”,”attrs”:{}}]},{“type”:”codeblock”,”attrs”:{“lang”:”shell”},”content”:[{“type”:”text”,”text”:”终端执行消费者订阅,开始阻塞获取消息/usr/local/opt/[email protected]/bin/php Subscribe.php;结果集:\n\n*  publish-subscribe git:(master) * /usr/local/opt/[email protected]/bin/php Subscribe.php\nchannel:mumu_test1,message:{\”key\”:\”key1\”,\”msg\”:\”I am li a mu !\”}\nchannel:mumu_test1,message:{\”key\”:\”key2\”,\”msg\”:\”I am li a mu !\”}\nchannel:mumu_test1,message:{\”key\”:\”key3\”,\”msg\”:\”I am li a mu !\”}\nchannel:mumu_test1,message:{\”key\”:\”key4\”,\”msg\”:\”I am li a mu !\”}\nchannel:mumu_test1,message:{\”key\”:\”key5\”,\”msg\”:\”I am li a mu !\”}\nchannel:mumu_test1,message:{\”key\”:\”key6\”,\”msg\”:\”I am li a mu !\”}\nchannel:mumu_test1,message:{\”key\”:\”key7\”,\”msg\”:\”I am li a mu !\”}\nchannel:mumu_test1,message:{\”key\”:\”key8\”,\”msg\”:\”I am li a mu !\”}\nchannel:mumu_test1,message:{\”key\”:\”key9\”,\”msg\”:\”I am li a mu !\”}\nchannel:mumu_test1,message:{\”key\”:\”key10\”,\”msg\”:\”I am li a mu !\”}\n\n上面就是生产者生成的消息内容:msg字符串\n\n终端执行生产者生产数据,开始发送消息/usr/local/opt/[email protected]/bin/php Publish.php;结果集:\n*  publish-subscribe git:(master) * /usr/local/opt/[email protected]/bin/php Publish.php\n1111111111\n\n// 这种场景是 我模拟发送了没有创建的频道 mumu_test4 导致返回的结果集都是0 说明没有被订阅的channel,消息会被丢弃\n*  publish-subscribe git:(master) * /usr/local/opt/[email protected]/bin/php Publish.php\n0000000000\n”,”attrs”:{}}]},{“type”:”heading”,”attrs”:{“align”:null,”level”:4},”content”:[{“type”:”text”,”text”:” 注意事项”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”text”:”1、订阅的消费者需要一直执行,阻塞获取消息,如果断开则表示退订了。”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”text”:”2、channel只接收publish发送的消息,自身是不存储消息,假如channel没有被订阅,则消息会被丢弃掉。”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”text”:”3、生产者生成消息时,只需要向频道内丢入消息即可。”,”attrs”:{}}]},{“type”:”heading”,”attrs”:{“align”:null,”level”:4},”content”:[{“type”:”text”,”text”:” 当然还有这些命令可以玩耍”,”attrs”:{}}]},{“type”:”codeblock”,”attrs”:{“lang”:”php”},”content”:[{“type”:”text”,”text”:”$redis->pubsub(‘channels’); // 获取所有频道\n$redis->pubsub(‘channels’, ‘*pattern*’); // 仅仅获取指定频道\n$redis->pubsub(‘numsub’, [‘channel1’, ‘channel2’]); // 查看指定频道的订阅数\n$redis->pubsub(‘numpat’); // 返回订阅模式的数量\n$redis->unsubscribe([‘channel1’, ‘channel2’]); // 客户端退订指定的频道\n$redis->punsubscribe([‘pattern1’, ‘pattern2’]); // 客户端退订所有指定定模式\n”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}},{“type”:”strong”,”attrs”:{}}],”text”:”小伙伴们本地实践操作起来~~~,千看不如写一遍。”,”attrs”:{}}]},{“type”:”heading”,”attrs”:{“align”:null,”level”:2},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}}],”text”:”redis发布订阅的优缺点”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”text”:”小伙伴们从上面的实践操作来看,PubSub生产的消息,如果没有对应的频道或者消费者,”,”attrs”:{}},{“type”:”codeinline”,”content”:[{“type”:”text”,”text”:”消息会被丢弃”,”attrs”:{}}],”marks”:[{“type”:”color”,”attrs”:{“color”:”#9654B5″,”name”:”user”}}],”attrs”:{}},{“type”:”text”,”text”:”,直接投递失败”,”attrs”:{}},{“type”:”codeinline”,”content”:[{“type”:”text”,”text”:”返回0状态”,”attrs”:{}}],”marks”:[{“type”:”color”,”attrs”:{“color”:”#9654B5″,”name”:”user”}}],”attrs”:{}},{“type”:”text”,”text”:”。假如我们实际生产环境在消费的时候,突然网络波动,导致其中一个消费者挂掉了一段时间,那么当它重新连接上的时候,中间这一段时间产生的消息也将不会存在。也就是说Redis本身是不会存储消息体信息的。”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”text”:”那么在我们生产环境数量不大且想节约成本的时候,redis的发布订阅功能可能比较适合我们公司;轻量级、方便使用配合”,”attrs”:{}},{“type”:”codeinline”,”content”:[{“type”:”text”,”text”:”consul+supervisor+swool”,”attrs”:{}}],”marks”:[{“type”:”color”,”attrs”:{“color”:”#9654B5″,”name”:”user”}}],”attrs”:{}},{“type”:”text”,”text”:”可以常驻内存,开多进程消费(消息队列也可以用的)。”,”attrs”:{}}]},{“type”:”heading”,”attrs”:{“align”:null,”level”:2},”content”:[{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}}],”text”:” 总结”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”text”:”哇哇哇,能有幸看到这里的小伙伴,我很服气你们了,我花了两天的时间去想去画去构思写好的文章;你们竟然也看到了这里,阿沐心里贼开心;阿沐确实很佩服小伙伴们,贼棒 、贼有毅力;同时也贼能包容阿沐的不足之处。”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null}},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”text”:”本文主要通过整理PubSub的实际操作指令,然后结合底层的源码分析它们之间的存储结构;再通过实际的客户端操作,来说明返回参数的具体意思;最最最后通过实践写代码运行展示。同时也列出PubSub的优缺点,帮助大家在实际的工作中可以有更好的选择。”,”attrs”:{}},{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}},{“type”:”strong”,”attrs”:{}}],”text”:”最后好记性不如多亲自动手实践,唯有实践,才知其本质。”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null}},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”text”:”最后,欢迎关注我的个人公众号「我是阿沐」,会不定期的更新后端知识点和学习笔记。也欢迎直接公众号私信或者邮箱联系我,我们可以一起学习,一起进步。”,”attrs”:{}}]},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null}},{“type”:”paragraph”,”attrs”:{“indent”:0,”number”:0,”align”:null,”origin”:null},”content”:[{“type”:”text”,”text”:”好了,我是阿沐,一个不想30岁就被淘汰的打工人 ️ ️ ️ 。创作不易觉得「”,”attrs”:{}},{“type”:”text”,”marks”:[{“type”:”color”,”attrs”:{“color”:”#773098″,”name”:”user”}},{“type”:”strong”,”attrs”:{}}],”text”:”阿沐”,”attrs”:{}},{“type”:”text”,”text”:”」写的有点料话: 关注一下, 分享一下,我们下期再见。”,”attrs”:{}}]}]}

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注