Github 仓库

demo-redis-subscribe

创建项目

  1. $ composer create hyperf/biz-skeleton demo-redis-subscribe dev-master
  2. Installing hyperf/biz-skeleton (dev-master 1eaa35a957cf704a5c9959c68e426a614c7598a2)
  3. - Installing hyperf/biz-skeleton (dev-master 1eaa35a): Cloning 1eaa35a957 from cache
  4. Created project in demo-redis-subscribe
  5. > @php -r "file_exists('.env') || copy('.env.example', '.env');"
  6. Loading composer repositories with package information
  7. Updating dependencies (including require-dev)
  8. Package operations: 133 installs, 0 updates, 0 removals
  9. - Installing ocramius/package-versions (1.4.0): Loading from cache
  10. - Installing hyperf/contract (dev-master 1624d1c): Cloning 1624d1ce0e from cache
  11. - Installing doctrine/inflector (v1.3.0): Loading from cache
  12. - Installing hyperf/utils (dev-master c847116): Cloning c847116cf9 from cache
  13. - Installing psr/container (1.0.0): Loading from cache
  14. - Installing hyperf/pool (dev-master 5a67570): Cloning 5a67570f71 from cache
  15. - Installing psr/event-dispatcher (1.0.0): Loading from cache
  16. - Installing hyperf/process (dev-master 75f4fbf): Cloning 75f4fbfa56 from cache
  17. - Installing doctrine/instantiator (1.2.0): Loading from cache
  18. - Installing psr/log (1.1.0): Loading from cache
  19. - Installing php-amqplib/php-amqplib (v2.10.0): Loading from cache
  20. - Installing hyperf/amqp (dev-master 1cff378): Cloning 1cff378bc4 from cache
  21. - Installing symfony/service-contracts (v1.1.6): Loading from cache
  22. - Installing symfony/polyfill-php73 (v1.12.0): Loading from cache
  23. - Installing symfony/polyfill-mbstring (v1.12.0): Loading from cache
  24. - Installing symfony/console (v4.3.4): Loading from cache
  25. - Installing hyperf/command (dev-master e4caea4): Cloning e4caea4c70 from cache
  26. - Installing hyperf/async-queue (dev-master 8d28229): Cloning 8d282297cd from cache
  27. - Installing psr/simple-cache (1.0.1): Loading from cache
  28. - Installing hyperf/cache (dev-master 60997fb): Cloning 60997fb05c from cache
  29. - Installing hyperf/circuit-breaker (dev-master e41726f): Cloning e41726fd25 from cache
  30. - Installing symfony/finder (v4.3.4): Loading from cache
  31. - Installing symfony/polyfill-ctype (v1.12.0): Loading from cache
  32. - Installing phpoption/phpoption (1.5.0): Loading from cache
  33. - Installing vlucas/phpdotenv (v3.6.0): Loading from cache
  34. - Installing hyperf/config (dev-master 44f5ef8): Cloning 44f5ef8a10 from cache
  35. - Installing psr/http-message (1.0.1): Loading from cache
  36. - Installing fig/http-message-util (1.1.3): Loading from cache
  37. - Installing hyperf/framework (dev-master 3be169b): Cloning 3be169b9f4 from cache
  38. - Installing hyperf/event (dev-master e9d97f1): Cloning e9d97f11fb from cache
  39. - Installing php-di/phpdoc-reader (2.1.0): Loading from cache
  40. - Installing doctrine/lexer (1.1.0): Loading from cache
  41. - Installing doctrine/annotations (v1.7.0): Loading from cache
  42. - Installing nikic/php-parser (v4.2.4): Loading from cache
  43. - Installing hyperf/di (dev-master 7f82227): Cloning 7f822276a0 from cache
  44. - Installing hyperf/constants (dev-master a3baaf8): Cloning a3baaf8bbd from cache
  45. - Installing hyperf/devtool (dev-master c3f424f): Cloning c3f424f2c6 from cache
  46. - Installing ralouphie/getallheaders (3.0.3): Loading from cache
  47. - Installing guzzlehttp/psr7 (1.6.1): Loading from cache
  48. - Installing guzzlehttp/promises (v1.3.1): Loading from cache
  49. - Installing guzzlehttp/guzzle (6.3.3): Loading from cache
  50. - Installing hyperf/guzzle (dev-master 90ad6e4): Cloning 90ad6e497b from cache
  51. - Installing react/promise (v2.7.1): Loading from cache
  52. - Installing guzzlehttp/streams (3.0.0): Loading from cache
  53. - Installing guzzlehttp/ringphp (1.1.1): Loading from cache
  54. - Installing elasticsearch/elasticsearch (v6.7.2): Loading from cache
  55. - Installing hyperf/elasticsearch (dev-master c936fc0): Cloning c936fc0f24 from cache
  56. - Installing monolog/monolog (1.25.1): Loading from cache
  57. - Installing hyperf/logger (dev-master 937101c): Cloning 937101c682 from cache
  58. - Installing hyperf/memory (dev-master 17003ec): Cloning 17003ec1e9 from cache
  59. - Installing hyperf/paginator (dev-master 4ffeb0e): Cloning 4ffeb0e46c from cache
  60. - Installing symfony/translation-contracts (v1.1.6): Loading from cache
  61. - Installing symfony/translation (v4.3.4): Loading from cache
  62. - Installing nesbot/carbon (2.24.0): Loading from cache
  63. - Installing hyperf/database (dev-master d36785e): Cloning d36785e709 from cache
  64. - Installing hyperf/model-listener (dev-master 5a77c83): Cloning 5a77c83cbe from cache
  65. - Installing hyperf/db-connection (dev-master 17eec65): Cloning 17eec65d60 from cache
  66. - Installing hyperf/model-cache (dev-master e3c5293): Cloning e3c5293a56 from cache
  67. - Installing hyperf/redis (dev-master 6043083): Cloning 6043083650 from cache
  68. - Installing hyperf/server (dev-master b0c8bd9): Cloning b0c8bd9e92 from cache
  69. - Installing zendframework/zend-stdlib (3.2.1): Loading from cache
  70. - Installing zendframework/zend-mime (2.7.1): Loading from cache
  71. - Installing hyperf/http-message (dev-master dcd1d78): Cloning dcd1d78b88 from cache
  72. - Installing psr/http-server-handler (1.0.1): Loading from cache
  73. - Installing psr/http-server-middleware (1.0.1): Loading from cache
  74. - Installing hyperf/dispatcher (dev-master 670f7dc): Cloning 670f7dca4f from cache
  75. - Installing hyperf/exception-handler (dev-master d1f3511): Cloning d1f3511c9c from cache
  76. - Installing nikic/fast-route (v1.3.0): Loading from cache
  77. - Installing hyperf/http-server (dev-master 2744b1a): Cloning 2744b1a949 from cache
  78. - Installing phpunit/php-timer (2.1.2): Loading from cache
  79. - Installing sebastian/environment (4.2.2): Loading from cache
  80. - Installing sebastian/version (2.0.1): Loading from cache
  81. - Installing sebastian/resource-operations (2.0.1): Loading from cache
  82. - Installing sebastian/object-reflector (1.1.1): Loading from cache
  83. - Installing sebastian/recursion-context (3.0.0): Loading from cache
  84. - Installing sebastian/object-enumerator (3.0.3): Loading from cache
  85. - Installing sebastian/global-state (2.0.0): Loading from cache
  86. - Installing sebastian/exporter (3.1.2): Loading from cache
  87. - Installing sebastian/diff (3.0.2): Loading from cache
  88. - Installing sebastian/comparator (3.0.2): Loading from cache
  89. - Installing phpunit/php-text-template (1.2.1): Loading from cache
  90. - Installing phpunit/php-file-iterator (2.0.2): Loading from cache
  91. - Installing theseer/tokenizer (1.1.3): Loading from cache
  92. - Installing sebastian/code-unit-reverse-lookup (1.0.1): Loading from cache
  93. - Installing phpunit/php-token-stream (3.1.1): Loading from cache
  94. - Installing phpunit/php-code-coverage (6.1.4): Loading from cache
  95. - Installing webmozart/assert (1.5.0): Loading from cache
  96. - Installing phpdocumentor/reflection-common (2.0.0): Loading from cache
  97. - Installing phpdocumentor/type-resolver (1.0.1): Loading from cache
  98. - Installing phpdocumentor/reflection-docblock (4.3.2): Loading from cache
  99. - Installing phpspec/prophecy (1.8.1): Loading from cache
  100. - Installing phar-io/version (2.0.1): Loading from cache
  101. - Installing phar-io/manifest (1.0.3): Loading from cache
  102. - Installing myclabs/deep-copy (1.9.3): Loading from cache
  103. - Installing phpunit/phpunit (7.5.16): Loading from cache
  104. - Installing hyperf/testing (dev-master 910f9e9): Cloning 910f9e94db from cache
  105. - Installing swoft/swoole-ide-helper (v4.4.6): Loading from cache
  106. - Installing symfony/filesystem (v4.3.4): Loading from cache
  107. - Installing symfony/config (v4.3.4): Loading from cache
  108. - Installing symfony/dependency-injection (v4.3.4): Loading from cache
  109. - Installing pdepend/pdepend (2.5.2): Loading from cache
  110. - Installing phpmd/phpmd (2.7.0): Loading from cache
  111. - Installing symfony/stopwatch (v4.3.4): Loading from cache
  112. - Installing symfony/process (v4.3.4): Loading from cache
  113. - Installing symfony/polyfill-php72 (v1.12.0): Loading from cache
  114. - Installing paragonie/random_compat (v9.99.99): Loading from cache
  115. - Installing symfony/polyfill-php70 (v1.12.0): Loading from cache
  116. - Installing symfony/options-resolver (v4.3.4): Loading from cache
  117. - Installing symfony/event-dispatcher-contracts (v1.1.5): Loading from cache
  118. - Installing symfony/event-dispatcher (v4.3.4): Loading from cache
  119. - Installing php-cs-fixer/diff (v1.3.0): Loading from cache
  120. - Installing composer/xdebug-handler (1.3.3): Loading from cache
  121. - Installing composer/semver (1.5.0): Loading from cache
  122. - Installing friendsofphp/php-cs-fixer (v2.15.3): Loading from cache
  123. - Installing hamcrest/hamcrest-php (v2.0.0): Loading from cache
  124. - Installing mockery/mockery (1.2.3): Loading from cache
  125. - Installing doctrine/reflection (v1.0.0): Loading from cache
  126. - Installing doctrine/event-manager (v1.0.0): Loading from cache
  127. - Installing doctrine/collections (v1.6.2): Loading from cache
  128. - Installing doctrine/cache (v1.8.0): Loading from cache
  129. - Installing doctrine/persistence (1.1.1): Loading from cache
  130. - Installing doctrine/common (v2.11.0): Loading from cache
  131. - Installing phpstan/phpdoc-parser (0.3.5): Loading from cache
  132. - Installing nette/utils (v3.0.1): Loading from cache
  133. - Installing nette/schema (v1.0.0): Loading from cache
  134. - Installing nette/finder (v2.5.1): Loading from cache
  135. - Installing nette/robot-loader (v3.2.0): Loading from cache
  136. - Installing nette/php-generator (v3.2.3): Loading from cache
  137. - Installing nette/neon (v3.0.0): Loading from cache
  138. - Installing nette/di (v3.0.1): Loading from cache
  139. - Installing nette/bootstrap (v3.0.0): Loading from cache
  140. - Installing jean85/pretty-package-versions (1.2): Loading from cache
  141. - Installing phpstan/phpstan (0.11.16): Loading from cache
  142. hyperf/utils suggests installing symfony/var-dumper (Required to use the dd function (^4.1).)
  143. hyperf/utils suggests installing symfony/serializer (Required to use SymfonyNormalizer (^4.3))
  144. hyperf/utils suggests installing symfony/property-access (Required to use SymfonyNormalizer (^4.3))
  145. symfony/console suggests installing symfony/lock
  146. guzzlehttp/psr7 suggests installing zendframework/zend-httphandlerrunner (Emit PSR-7 responses)
  147. monolog/monolog suggests installing graylog2/gelf-php (Allow sending log messages to a GrayLog2 server)
  148. monolog/monolog suggests installing sentry/sentry (Allow sending log messages to a Sentry server)
  149. monolog/monolog suggests installing doctrine/couchdb (Allow sending log messages to a CouchDB server)
  150. monolog/monolog suggests installing ruflin/elastica (Allow sending log messages to an Elastic Search server)
  151. monolog/monolog suggests installing ext-amqp (Allow sending log messages to an AMQP server (1.0+ required))
  152. monolog/monolog suggests installing ext-mongo (Allow sending log messages to a MongoDB server)
  153. monolog/monolog suggests installing mongodb/mongodb (Allow sending log messages to a MongoDB server via PHP Driver)
  154. monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log messages to AWS services like DynamoDB)
  155. monolog/monolog suggests installing rollbar/rollbar (Allow sending log messages to Rollbar)
  156. monolog/monolog suggests installing php-console/php-console (Allow sending log messages to Google Chrome)
  157. symfony/translation suggests installing symfony/yaml
  158. hyperf/database suggests installing doctrine/dbal (Required to rename columns (^2.6).)
  159. zendframework/zend-mime suggests installing zendframework/zend-mail (Zend\Mail component)
  160. sebastian/global-state suggests installing ext-uopz (*)
  161. phpunit/php-code-coverage suggests installing ext-xdebug (^2.6.0)
  162. phpunit/phpunit suggests installing phpunit/php-invoker (^2.0)
  163. phpunit/phpunit suggests installing ext-xdebug (*)
  164. symfony/config suggests installing symfony/yaml (To use the yaml reference dumper)
  165. symfony/dependency-injection suggests installing symfony/yaml
  166. symfony/dependency-injection suggests installing symfony/expression-language (For using expressions in service container configuration)
  167. symfony/dependency-injection suggests installing symfony/proxy-manager-bridge (Generate service proxies to lazy load them)
  168. paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)
  169. symfony/event-dispatcher suggests installing symfony/http-kernel
  170. friendsofphp/php-cs-fixer suggests installing php-cs-fixer/phpunit-constraint-isidenticalstring (For IsIdenticalString constraint.)
  171. friendsofphp/php-cs-fixer suggests installing php-cs-fixer/phpunit-constraint-xmlmatchesxsd (For XmlMatchesXsd constraint.)
  172. doctrine/cache suggests installing alcaeus/mongo-php-adapter (Required to use legacy MongoDB driver)
  173. nette/bootstrap suggests installing tracy/tracy (to use Configurator::enableTracy())
  174. Writing lock file
  175. Generating autoload files
  176. ocramius/package-versions: Generating version class...
  177. ocramius/package-versions: ...done generating version class
  178. Do you want to remove the existing VCS (.git, .svn..) history? [Y,n]? Y

  

定义队列

我们希望可以监听多个队列,所以便把队列名字额外定义出来。

  1. <?php
  2.  
  3. declare(strict_types=1);
  4. /**
  5. * This file is part of Hyperf.
  6. *
  7. * @link https://www.hyperf.io
  8. * @document https://doc.hyperf.io
  9. * @contact group@hyperf.io
  10. * @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
  11. */
  12.  
  13. namespace App\Constants;
  14.  
  15. class Channel
  16. {
  17. const QUEUE = 'channel.queue';
  18.  
  19. const TEST = 'channel.test';
  20.  
  21. public static function getArray()
  22. {
  23. return [
  24. self::QUEUE,
  25. self::TEST,
  26. ];
  27. }
  28. }

  

创建用于订阅的 Redis 实例

更新配置

autoload/redis.php 中新增 subscriber 相关配置

  1. <?php
  2.  
  3. declare(strict_types=1);
  4. /**
  5. * This file is part of Hyperf.
  6. *
  7. * @link https://www.hyperf.io
  8. * @document https://doc.hyperf.io
  9. * @contact group@hyperf.io
  10. * @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
  11. */
  12.  
  13. return [
  14. 'default' => [
  15. 'host' => env('REDIS_HOST', 'localhost'),
  16. 'auth' => env('REDIS_AUTH', null),
  17. 'port' => (int) env('REDIS_PORT', 6379),
  18. 'db' => (int) env('REDIS_DB', 0),
  19. 'pool' => [
  20. 'min_connections' => 1,
  21. 'max_connections' => 10,
  22. 'connect_timeout' => 10.0,
  23. 'wait_timeout' => 3.0,
  24. 'heartbeat' => -1,
  25. 'max_idle_time' => (float) env('REDIS_MAX_IDLE_TIME', 60),
  26. ],
  27. ],
  28. 'subscriber' => [
  29. 'host' => env('REDIS_HOST', 'localhost'),
  30. 'auth' => env('REDIS_AUTH', null),
  31. 'port' => (int) env('REDIS_PORT', 6379),
  32. 'db' => (int) env('REDIS_DB', 0),
  33. 'options' => [
  34. \Redis::OPT_READ_TIMEOUT => '-1',
  35. ],
  36. 'pool' => [
  37. 'min_connections' => 1,
  38. 'max_connections' => 10,
  39. 'connect_timeout' => 10.0,
  40. 'wait_timeout' => 3.0,
  41. 'heartbeat' => -1,
  42. 'max_idle_time' => (float) env('REDIS_MAX_IDLE_TIME', 60),
  43. ],
  44. ],
  45. ];

  

增加 Subscriber 客户端

  1. <?php
  2. <?php
  3.  
  4. declare(strict_types=1);
  5. /**
  6. * This file is part of Hyperf.
  7. *
  8. * @link https://www.hyperf.io
  9. * @document https://doc.hyperf.io
  10. * @contact group@hyperf.io
  11. * @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
  12. */
  13.  
  14. namespace App\Process;
  15.  
  16. use App\Constants\Channel;
  17. use App\Kernel\Subscriber;
  18. use Hyperf\Process\AbstractProcess;
  19. use Hyperf\Process\Annotation\Process;
  20.  
  21. /**
  22. * @Process(name="RedisConsumerProcess")
  23. */
  24. class RedisConsumerProcess extends AbstractProcess
  25. {
  26. public function handle(): void
  27. {
  28. $redis = di()->get(Subscriber::class);
  29.  
  30. $redis->subscribe(Channel::getArray(), function ($instance, $channelName, $message) {
  31. var_dump($instance);
  32. var_dump($channelName);
  33. var_dump($message);
  34.  
  35. // TODO: 执行对应的消费操作
  36. });
  37. }
  38. }

  

测试代码

修改 IndexController 如下

  1. <?php
  2.  
  3. declare(strict_types=1);
  4. /**
  5. * This file is part of Hyperf.
  6. *
  7. * @link https://www.hyperf.io
  8. * @document https://doc.hyperf.io
  9. * @contact group@hyperf.io
  10. * @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
  11. */
  12.  
  13. namespace App\Controller;
  14.  
  15. use App\Constants\Channel;
  16.  
  17. class IndexController extends Controller
  18. {
  19. public function index()
  20. {
  21. $user = $this->request->input('user', 'Hyperf');
  22. $method = $this->request->getMethod();
  23.  
  24. $redis = di()->get(\Redis::class);
  25.  
  26. $redis->publish(Channel::TEST, $user);
  27.  
  28. return $this->response->success([
  29. 'user' => $user,
  30. 'method' => $method,
  31. 'message' => 'Hello Hyperf.',
  32. ]);
  33. }
  34. }

  

启动 Server,测试结果

  1. $ curl http://127.0.0.1:9501/
  2. {"code":0,"data":{"user":"Hyperf","method":"GET","message":"Hello Hyperf."}}

  

  1. 终端显示如下
  1. object(Redis)#47173 (0) {
  2. }
  3. string(12) "channel.test"
  4. string(6) "Hyperf"

  

未完待续

...

更多学习内容请访问:

腾讯T3-T4标准精品PHP架构师教程目录大全,只要你看完保证薪资上升一个台阶(持续更新)

基于 Redis 的订阅与发布的更多相关文章

  1. 利用redis的订阅和发布来实现实时监控的一个DEMO(Python版本)

    redis的list类型有个很好的特性,就是每次添加元素后会返回当前list的长度,利用这个特点,我们可以监控它的长度,比如我们的key是用户注册的IP地址,list中存放的是已经在此IP地址上注册的 ...

  2. redis的订阅和发布

    #订阅和发布有什么用呢?# 特点# 1.实现一个一对多的效果,只有一个发布者,多个订阅者# 2.实时的发布消息,广播方发布消息,所有的订阅者都会受到消息,一个人同时只能接受#一个频道 1.先写一个公共 ...

  3. 在php中实现Redis的订阅与发布

    <?php //require_once dirname(__FILE__).'/class/RedisClass.class.php'; function init_redis(){ $red ...

  4. Redis消息订阅与发布

    监听器的创建 package com.sogou.baike.testimport.testSubscribe; import redis.clients.jedis.JedisPubSub; pub ...

  5. 基于Redis的消息订阅/发布

    在工业生产设计中,我们往往需要实现一个基于消息订阅的模式,用来对非定时的的消息进行监听订阅. 这种设计模式在 总线设计模式中得到体现.微软以前的WCF中实现了服务总线 ServiceBus的设计模式. ...

  6. 基于Redis消息的订阅发布应用场景

    目录 基于Redis消息的订阅发布应用场景 1.应用背景 2.困境 2.1 锁表风险 2.2 实时性差 2.3 增加编程复杂性 2.4 实时效果 3.解决方案 3.1 前端传值给服务端 3.2 服务端 ...

  7. 基于redis的消息订阅与发布

    Redis 的 SUBSCRIBE 命令可以让客户端订阅任意数量的频道, 每当有新信息发送到被订阅的频道时, 信息就会被发送给所有订阅指定频道的客户端. 作为例子, 下图展示了频道 channel1  ...

  8. 分布式消息总线,基于.NET Socket Tcp的发布-订阅框架之离线支持,附代码下载

    一.分布式消息总线以及基于Socket的实现 在前面的分享一个分布式消息总线,基于.NET Socket Tcp的发布-订阅框架,附代码下载一文之中给大家分享和介绍了一个极其简单也非常容易上的基于.N ...

  9. Spring Boot使用Redis进行消息的发布订阅

    今天来学习如何利用Spring Data对Redis的支持来实现消息的发布订阅机制.发布订阅是一种典型的异步通信模型,可以让消息的发布者和订阅者充分解耦.在我们的例子中,我们将使用StringRedi ...

随机推荐

  1. 【5min+】更好的选项实践。.Net Core中的IOptions

    系列介绍 [五分钟的dotnet]是一个利用您的碎片化时间来学习和丰富.net知识的博文系列.它所包含了.net体系中可能会涉及到的方方面面,比如C#的小细节,AspnetCore,微服务中的.net ...

  2. IP协议的助手 —— ICMP 协议

    IP协议的助手 —— ICMP 协议 IP协议的助手 —— ICMP 协议 ping 是基于 ICMP 协议工作的,所以要明白 ping 的工作,首先我们先来熟悉 ICMP 协议. ICMP 是什么? ...

  3. HDU 4325 Flowers 树状数组+离散化

    Flowers Problem Description As is known to all, the blooming time and duration varies between differ ...

  4. GitHub也会断供:美国制裁地区帐号都受限,毫无预警,个人页面直接404

    请注意,GitHub也有断供危机. 如果你有GitHub私有库,是时候重新思考安全性,也是时候制定备份策略. 这不是杞人忧天,也不只温馨提示,而是已经发生的事实. 一位伊朗程序员,一觉醒来GitHub ...

  5. Java中的集合类、Lambda、鲁棒性简述

    集合类 在java.util包中提供了一些集合类,常用的有List.Set和Map类,其中List类和Set类继承了Collection接口.这些集合类又称为容器,长度是可变的,数组用来存放基本数据类 ...

  6. Mysql数据库主键,外键,索引概述

    主键: 主键是数据表的唯一索引,比如学生表里有学号和姓名,姓名可能有重名的,但学号确是唯一的,你要从学生表中搜索一条纪录如查找一个人,就只能根据学号去查找,这才能找出唯一的一个,这就是主键;如:id ...

  7. SpringApplication对象是如何构建的? SpringBoot源码(八)

    注:该源码分析对应SpringBoot版本为2.1.0.RELEASE 本篇接 SpringBoot的启动流程是怎样的?SpringBoot源码(七) 1 温故而知新 温故而知新,我们来简单回顾一下上 ...

  8. 爬虫简介和requests模块

    目录 爬虫介绍 requests模块 requests模块 1.requests模块的基本使用 2.get 请求携带参数,调用params参数,其本质上还是调用urlencode 3.携带header ...

  9. Codeforces Round #565 (Div. 3)--D. Recover it!--思维+欧拉筛

    D. Recover it! Authors guessed an array aa consisting of nn integers; each integer is not less than ...

  10. 实践指路明灯,源码剖析flink-metrics

    1. 通过上期的分享,我们对 Metrics 类库有了较深入的认识,并对指标监控的几个度量类型了如指掌. 本期,我们将走进当下最火的流式处理框架 flink 的源码,一同深入并学习一下别人家的代码. ...