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

ActiveLibrary[Caching](/categories/caching)

flatphp/cache
=============

cache component

v3.0.0(4y ago)1631MITPHPPHP &gt;=8.1

Since Apr 12Pushed 4y ago1 watchersCompare

[ Source](https://github.com/flatphp/cache)[ Packagist](https://packagist.org/packages/flatphp/cache)[ RSS](/packages/flatphp-cache/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (1)Versions (5)Used By (1)

Cache
=====

[](#cache)

Light cache component;

relate:

Install
-------

[](#install)

```
composer require "flatphp/cache"
```

Init Config
-----------

[](#init-config)

```
use Flatphp\Memstore\Conn;
use Flatphp\Cache\Cache;

Conn::init(array(
    'memcache' => ['host' => '127.0.0.1', 'port' => 11211]
));

Cache::init(array(
    'expiration' => 3600, // the default expiration, 0 forever[default]
    'storage' => 'memcache',
));

// -------- OR --------------------

Cache::init(array(
    'expiration' => 3600, // the default expiration, 0 forever[default]
    'storage' => array(
        'driver' => 'redis',
	'host' => 'localhost',
	'port' => 6379
    )
));
```

Useage
------

[](#useage)

```
use Flatphp\Cache\Cache;

Cache::set('test', 1, 60);
echo Cache::get('test');
Cache::delete('test');
Cache::flush();

Cache::increment('test', 2);
Cache::decrement('test', 2);

Cache::getData('test', function(){
    return 'hello';
});
```

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity75

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

Total

4

Last Release

1610d ago

Major Versions

v1.0.0 → v2.0.02017-04-14

v2.0.1 → v3.0.02022-02-02

PHP version history (2 changes)v1.0.0PHP &gt;=5.5

v3.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/e3e4d193838370dbe5119947cb84acd917f9e7dd4baf5ed9d0dbc88f26310fa5?d=identicon)[fredyang](/maintainers/fredyang)

---

Top Contributors

[![shukyoo](https://avatars.githubusercontent.com/u/2231396?v=4)](https://github.com/shukyoo "shukyoo (2 commits)")

---

Tags

cache

### Embed Badge

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

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

###  Alternatives

[psr/simple-cache

Common interfaces for simple caching

8.1k772.9M2.6k](/packages/psr-simple-cache)[psr/cache

Common interface for caching libraries

5.2k726.4M1.6k](/packages/psr-cache)[react/cache

Async, Promise-based cache interface for ReactPHP

445131.2M46](/packages/react-cache)[beste/in-memory-cache

A PSR-6 In-Memory cache that can be used as a fallback implementation and/or in tests.

2515.9M12](/packages/beste-in-memory-cache)[fastd/fastd

A High Performance API Framework By Swoole Extension

42015.5k18](/packages/fastd-fastd)[anahkiasen/flatten

A package for the Illuminate framework that flattens pages to plain HTML

33113.0k](/packages/anahkiasen-flatten)

PHPackages © 2026

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