PHPackages                             guanhui07/redis - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. guanhui07/redis

ActiveLibrary[Caching](/categories/caching)

guanhui07/redis
===============

swoole-redis-pool

v1.1.0(3y ago)2431MITPHPPHP ^7.4 || ^8.0

Since Feb 5Pushed 1y ago1 watchersCompare

[ Source](https://github.com/guanhui07/redis)[ Packagist](https://packagist.org/packages/guanhui07/redis)[ RSS](/packages/guanhui07-redis/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (1)

dcr-redis
=========

[](#dcr-redis)

Swoole Redis连接池 自动归还 基础的Redis分布式 互斥锁

说明
--

[](#说明)

```
使用 Lock（互斥锁） 之前需要先 初始化 Redis
如果你是在多进程的模式下使用 那么请在每个进程 Start 的时候 初始化Redis
如若不然会导致 你的连接 每个进程都在使用，那么就会崩~
swoole 的很多框架 都有实现 什么Redis代理的 你连进程隔离都不用管自动维护了但是好像都不支持完全协程化的写法

```

安装
--

[](#安装)

`composer require guanhui07/redis`

使用
--

[](#使用)

```
    \DcrRedis\Redis::initialize((new RedisConfig())
       ->withHost('127.0.0.1')
        ->withPort(6379)
        ->withAuth('')
        ->withDbIndex(1)
        ->withTimeout(1),
        64
    );

    go(function (){
        $ArtLock = new \DcrRedis\Lock('goods_100',5000);
        $status = $ArtLock->lock();
        if (!$status){
            echo '请求一:进入失败'.PHP_EOL;
            return;
        }
        echo '请求一:进入成功'.PHP_EOL;
        \Co\System::sleep(7);
        $status = $ArtLock->unLock();
        if(!$status){
            echo '请求一:退出失败'.PHP_EOL;
            return;
        }
        echo '请求一:退出成功'.PHP_EOL;
    });
    go(function (){
        $ArtLock = new \DcrRedis\Lock('goods_100',5000);
        $status = $ArtLock->lock();
        if (!$status){
            echo '请求二:进入失败'.PHP_EOL;
            return;
        }
        echo '请求二:进入成功'.PHP_EOL;
        \Co\System::sleep(3);
        $status = $ArtLock->unLock();
        if(!$status){
            echo '请求二:退出失败'.PHP_EOL;
            return;
        }
        echo '请求二:退出成功'.PHP_EOL;
    });
    });
```

我的其他包：
------

[](#我的其他包)

 借鉴Laravel实现的 PHP Framework ，FPM模式、websocket使用的workerman、支持容器、PHP8特性attributes实现了路由注解、中间件注解、Laravel Orm等特性

 Swoole模式下 Redis连接池

 facade、门面 fpm模式下可使用

 基于swoole实现的crontab秒级定时任务

 基于 illuminate/database 做的连接池用于适配Swoole的协程环境

 高性能PHP Framework ，Cli模式，基于Swoole实现，常驻内存，协程框架，支持容器、切面、PHP8特性attributes实现了路由注解、中间件注解、支持Laravel Orm等特性

 附近的人

 chatgpt sdk

 php定时器，参考了workerman源码 实现一个单进程(守护进程)的定时器。

 open-ai chatgpt调用

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

1193d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3abde3fccf025ce86670101d7cfa0641d2415c9daad93e5f0c9573a2b23ddbda?d=identicon)[guanhui07](/maintainers/guanhui07)

---

Top Contributors

[![guanhui07](https://avatars.githubusercontent.com/u/5820457?v=4)](https://github.com/guanhui07 "guanhui07 (12 commits)")

---

Tags

lockphppoolredisswoole

### Embed Badge

![Health badge](/badges/guanhui07-redis/health.svg)

```
[![Health](https://phpackages.com/badges/guanhui07-redis/health.svg)](https://phpackages.com/packages/guanhui07-redis)
```

###  Alternatives

[predis/predis

A flexible and feature-complete Redis/Valkey client for PHP.

7.8k305.7M2.4k](/packages/predis-predis)[snc/redis-bundle

A Redis bundle for Symfony

1.0k39.4M67](/packages/snc-redis-bundle)[react/cache

Async, Promise-based cache interface for ReactPHP

444112.4M40](/packages/react-cache)[wp-media/wp-rocket

Performance optimization plugin for WordPress

7431.3M3](/packages/wp-media-wp-rocket)[illuminate/cache

The Illuminate Cache package.

12835.6M1.4k](/packages/illuminate-cache)[colinmollenhour/php-redis-session-abstract

A Redis-based session handler with optimistic locking

6325.6M14](/packages/colinmollenhour-php-redis-session-abstract)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
