glider88/async-redis-streams 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

glider88/async-redis-streams

Composer 安装命令:

composer require glider88/async-redis-streams

包简介

Redis Streams with TrueAsync

README 文档

README

Installation:

composer require glider88/async-redis-streams

Start docker:

bin/re # first time
bin/up # next times

Tests:

bin/unit

Run example:

Producer:

bin/php examples/producer.php

Consumer:

bin/php examples/consumer.php

Settings:

$config = new Config(
    redisUrl: 'redis://redis:6379',
    stream: 's',                                          // stream name
    group: 'g',                                           // consumer group name
    scaling: new PiecewiseLinearScaling([                 // complex scaling number of workers, for empty stream (< 500) use 16 worker, next 32
        12 => 0,
        32 => 500,
    ]),
    healthcheckInterval: new Sec(100),                     // redis health check interval
    maxStreamLength: 1000,                                 // approximate stream size
    maxDlqStreamLength: 1000,                              // approximate stream size for dead letters
    readRetrySetCount: 100,                                // how many entities we get at time from redis sorted set
    readAutoClaimCount: 100,                               // how many autoclaim entities we get at time
    blockRead: new Sec(1),                                 // how long we wait first data from stream
    deduplicationTtl: new Sec(3),                          // for deduplication logic used `SET $streamMessageId . '-' . $this->group` with this ttl
    autoClaimMinIdle: new Sec(2),                          // after this time we get message from PEL by autoclaim
    timeoutJob: new Sec(1),                                // timeout for job, after which we cancel it by TimeoutCancellation exception
    retryInterval: new Milli(100),                         // how often we launch retry logic
    maxRetries: 3,                                         // after we send message to dead letters stream (with s:dql name)
    retry: new MultiplyRetry(                              // retry with incremental increase time: 0 1 2 3... seconds wait before retry
        firstOffsetDelay: new Milli(0),
        baseDelay: new Sec(1),
    ),
    claimInterval: new Milli(100),                         // how often we launch autoclaim logic
    logger: new NullLogger(),
    minRedisWorkers: 1,                                    // Async\Pool: How many redis connections to create in advance (pre-warming)
    maxRedisWorkers: 100,                                  // Async\Pool: Maximum redis connections
    threadBootloader: static function () {                 // Async\Thread bootloader
        require  '/usr/src/app/examples/bootstrap.php';
        require  '/usr/src/app/vendor/autoload.php';
    },
    consumer: 'c'                                          // consumer name
);

$stream = new Stream($config);

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固