PHPackages                             zxin/think-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. zxin/think-redis

ActiveLibrary[Caching](/categories/caching)

zxin/think-redis
================

think redis

v2.2.1(1y ago)03.0kApache-2.0PHPPHP ~8.0CI passing

Since Aug 14Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/NHZEX/think-redis)[ Packagist](https://packagist.org/packages/zxin/think-redis)[ RSS](/packages/zxin-think-redis/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (9)Versions (20)Used By (0)

Think-Redis
===========

[](#think-redis)

[![Latest Stable Version](https://camo.githubusercontent.com/eeba21f7515bb66f43ed14f2fc45ca5d8a21eebd16689959abc535ea56650ce0/68747470733a2f2f706f7365722e707567782e6f72672f7a78696e2f7468696e6b2d72656469732f762f737461626c65)](https://packagist.org/packages/zxin/think-redis)[![License](https://camo.githubusercontent.com/d857ad71aee68c84743e983a76b4841e2afe18bb5c78d712fab7a92f59199f5e/68747470733a2f2f706f7365722e707567782e6f72672f7a78696e2f7468696e6b2d72656469732f6c6963656e7365)](https://packagist.org/packages/zxin/think-redis)[![workflows](https://github.com/nhzex/think-redis/workflows/ci/badge.svg)](https://github.com/NHZEX/think-redis/actions)[![coverage](https://camo.githubusercontent.com/c1f7c27e87b43a4985c94826cd65b4eb72ec2e5a38e7916b956b04666e88e7a5/68747470733a2f2f636f6465636f762e696f2f67682f6e687a65782f7468696e6b2d72656469732f67726170682f62616467652e737667)](https://codecov.io/gh/nhzex/think-redis)

快速使用
====

[](#快速使用)

### 安装

[](#安装)

```
composer require zxin/think-redis
```

### 普通环境下直接使用。

[](#普通环境下直接使用)

```
\Zxin\Think\Redis\RedisManager::store()->get('xxxx');
```

### 协程环境下使用方法与普通环境一致，但为了更优雅的退出，在`workerStop`与`workerExit`下调用以下代码。

[](#协程环境下使用方法与普通环境一致但为了更优雅的退出在workerstop与workerexit下调用以下代码)

```
\Zxin\Think\Redis\RedisManager::destroy();
```

### 替换`Cache`中的`redis`驱动以提供全局`redis`管理服务

[](#替换cache中的redis驱动以提供全局redis管理服务)

1. 先在`config/redis.php`配置文件声明一个连接
2. `config/cache.php`配置文件中需要提供redis连接的位置替换驱动

```
[
    'default' => 'test',
    'stores' => [
        'test' => [
            'type' => \Zxin\Think\Redis\CacheDriver::class,
            'connection' => 'main_redis', // 在redis统一配置中声明的有效连接
            ...
        ],
        ...
    ]
]

```

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance51

Moderate activity, may be stable

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity68

Established project with proven stability

 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 ~101 days

Recently: every ~13 days

Total

18

Last Release

379d ago

Major Versions

v1.x-dev → v2.0.02023-08-11

PHP version history (4 changes)v1.0.0PHP ~7.2

v1.2.0PHP ~7.2 | ~8.0

v1.3.0PHP ~7.4 | ~8.0

v2.0.0PHP ~8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/4de65936ae77499b5393e7c4d094ea6adef938925d4ad806e52be91069b00165?d=identicon)[NHZEX](/maintainers/NHZEX)

---

Top Contributors

[![NHZEX](https://avatars.githubusercontent.com/u/14545600?v=4)](https://github.com/NHZEX "NHZEX (79 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Type Coverage Yes

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/zxin-think-redis/health.svg)](https://phpackages.com/packages/zxin-think-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)
