PHPackages                             friendsofhyperf/cache - 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. friendsofhyperf/cache

ActiveLibrary[Caching](/categories/caching)

friendsofhyperf/cache
=====================

The cache component for Hyperf.

v3.1.76(5mo ago)237.0k↓32%1MITPHP

Since May 21Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/friendsofhyperf/cache)[ Packagist](https://packagist.org/packages/friendsofhyperf/cache)[ Fund](https://hdj.me/sponsors/)[ GitHub Sponsors](https://github.com/huangdijia)[ RSS](/packages/friendsofhyperf-cache/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (127)Used By (0)

Cache
=====

[](#cache)

[![Latest Stable Version](https://camo.githubusercontent.com/3585bc0e2231bd6904e42349d9e6cee9041bdcb4edf3b669fad32ea4bcf17740/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f667269656e64736f666879706572662f6361636865)](https://packagist.org/packages/friendsofhyperf/cache)[![Total Downloads](https://camo.githubusercontent.com/caf93c293e89c1a5fa3bb04336bcd6c687e49b3ae8ed9553f5ad68990b141dcd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f667269656e64736f666879706572662f6361636865)](https://packagist.org/packages/friendsofhyperf/cache)[![License](https://camo.githubusercontent.com/27c1a2e66ef758db3797292cea38a9aeab93b0339b2cb8b29f123b33bace917c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f667269656e64736f666879706572662f6361636865)](https://github.com/friendsofhyperf/cache)

The cache component for Hyperf.

Installation
------------

[](#installation)

- Installation

```
composer require friendsofhyperf/cache
```

Usage
-----

[](#usage)

- Inject

```
namespace App\Controller;

use FriendsOfHyperf\Cache\Contract\CacheInterface;
use Hyperf\Di\Annotation\Inject;

class IndexController
{

    #[Inject]
    private CacheInterface $cache;

    public function index()
    {
        return $this->cache->remember($key, $ttl=60, function() {
            // return sth
        });
    }
}
```

- Facade

```
use FriendsOfHyperf\Cache\Facade\Cache;

Cache::remember($key, $ttl=60, function() {
    // return sth
});
```

- Switch driver

```
use FriendsOfHyperf\Cache\Facade\Cache;
use FriendsOfHyperf\Cache\CacheManager;

Cache::store('co')->remember($key, $ttl=60, function() {
    // return sth
});

di(CacheManager::class)->store('co')->remember($key, $ttl=60, function() {
    // return sth
});
```

Methods
-------

[](#methods)

Likes [Laravel-Cache](https://laravel.com/docs/8.x/cache)

Contact
-------

[](#contact)

- [Twitter](https://twitter.com/huangdijia)
- [Gmail](mailto:huangdijia@gmail.com)

License
-------

[](#license)

[MIT](LICENSE)

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance72

Regular maintenance activity

Popularity32

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 98.9% 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 ~10 days

Recently: every ~2 days

Total

126

Last Release

165d ago

Major Versions

v2.0.9 → v3.0.0-beta42022-05-24

v2.0.11 → v3.0.0-beta222022-06-24

v2.0.19 → v3.0.0-rc.162022-09-21

v2.0.24 → v3.0.02023-01-02

2.0.x-dev → v3.0.62023-01-30

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8337659?v=4)[Deeka Wong](/maintainers/huangdijia)[@huangdijia](https://github.com/huangdijia)

---

Top Contributors

[![huangdijia](https://avatars.githubusercontent.com/u/8337659?v=4)](https://github.com/huangdijia "huangdijia (92 commits)")[![szutoutou](https://avatars.githubusercontent.com/u/17758819?v=4)](https://github.com/szutoutou "szutoutou (1 commits)")

---

Tags

hyperfv3.1

### Embed Badge

![Health badge](/badges/friendsofhyperf-cache/health.svg)

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

###  Alternatives

[hyperf/database

A flexible database library.

202.8M257](/packages/hyperf-database)[hyperf/validation

hyperf validation

122.1M166](/packages/hyperf-validation)[limingxinleo/hyperf-utils

Utils for Hyperf.

29133.9k3](/packages/limingxinleo-hyperf-utils)[hyperf/crontab

A crontab component for Hyperf.

131.6M62](/packages/hyperf-crontab)[friendsofhyperf/lock

The lock component for Hyperf.

1447.4k](/packages/friendsofhyperf-lock)[hyperf/http-server

A HTTP Server for Hyperf.

102.8M305](/packages/hyperf-http-server)

PHPackages © 2026

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