PHPackages                             biurad/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. [Database &amp; ORM](/categories/database)
4. /
5. biurad/cache

ActiveLibrary[Database &amp; ORM](/categories/database)

biurad/cache
============

A library that provides an advanced caching system for PSR-6 and PSR-16

v0.2.4(5y ago)21.1k[1 PRs](https://github.com/biurad/php-cache/pulls)BSD-3-ClausePHPPHP ^7.2CI passing

Since Nov 17Pushed 1w ago1 watchersCompare

[ Source](https://github.com/biurad/php-cache)[ Packagist](https://packagist.org/packages/biurad/cache)[ Docs](https://www.biurad.com)[ Fund](https://biurad.com/sponsor)[ Patreon](https://www.patreon.com/biurad)[ RSS](/packages/biurad-cache/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (10)Dependencies (4)Versions (11)Used By (0)

The Poakium Cache
=================

[](#the-poakium-cache)

[![Latest Version](https://camo.githubusercontent.com/8c5f6394549e02d4712afa6f84bd33b2d15ce4acf5627e97577294015579e6f0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6269757261642f63616368653f696e636c7564655f70726572656c6561736573266c6162656c3d4c6174657374267374796c653d666c61742d737175617265)](https://packagist.org/packages/biurad/cache)[![Workflow Status](https://camo.githubusercontent.com/e03f239f4a6ea9a7417660b45969f44fc904b5c7033bfce649f4cff83695bd9e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6269757261642f706f616b69756d2f63692e796d6c3f6272616e63683d6d6173746572266c6162656c3d576f726b666c6f77267374796c653d666c61742d737175617265)](https://github.com/biurad/poakium/actions?query=workflow)[![Software License](https://camo.githubusercontent.com/60ac539222d3d3f23e79f481e6df7f6cd5746a1bdaa2e1c519a081c1ec8f32c4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4253442d2d332d627269676874677265656e2e7376673f266c6162656c3d506f616b69756d267374796c653d666c61742d737175617265)](LICENSE)[![Maintenance Status](https://camo.githubusercontent.com/f82a47d6ee4888cc5335fac4cdea0c782ec05cb748f596b3f1689cc62aa76ae5/68747470733a2f2f696d672e736869656c64732e696f2f6d61696e74656e616e63652f7965732f323032333f6c6162656c3d4d61696e7461696e6564267374796c653d666c61742d737175617265)](https://github.com/biurad/poakium)

---

A [PHP](https://php.net) library that provides a high-performance caching system for storing the results of expensive computations, database queries, or network requests. Supports both [PSR-6](http://www.php-fig.org/psr/psr-6/) and [PSR-16](http://www.php-fig.org/psr/psr-16/) caching standards.

📦 Installation
--------------

[](#-installation)

This project requires [PHP](https://php.net) 7.2 or higher. The recommended way to install, is via [Composer](https://getcomposer.org). Simply run:

```
$ composer require biurad/cache
```

📍 Quick Start
-------------

[](#-quick-start)

One of the key features of this library is its ability to cache the result of a callable or function, allowing for the caching of complex computations or database queries. Additionally, it includes a fallback load feature to ensure that the cached value is always fetched, even if it has expired from the cache.

Here is an example of how to use the library using [symfony/cache](https://github.com/symfony/cache):

```
use Biurad\Cache\FastCache as Cache;
use Psr\Cache\CacheItemInterface;
use Symfony\Component\Cache\Adapter\PhpFilesAdapter;

$storage = new PhpFilesAdapter(directory: __DIR__.'/cache');
$cache = new Cache($storage);
$cache->setCacheItem(\Symfony\Component\Cache\CacheItem::class);

// The callable will only be executed on a cache miss.
$value = $cache->load(
    'my_cache_key',
    static function (CacheItemInterface $item): CacheItemInterface {
        $item->expiresAfter(3600);

        // ... do some HTTP request or heavy computations
        $item->set('foobar');

        return $item;
    }
);

echo $value; // 'foobar'

// ... and to remove the cache key
$cache->delete('my_cache_key');

// cache the result of the function
$ip = $cache->call('gethostbyaddr', "127.0.0.1");

function calculate(array $a, array $b): array {
    $result = [];
    foreach ($a as $i => $v) foreach ($v as $k => $m) $result[$i][$k] = $m + $b[$i][$k];

    return $result;
}

$matrix = $cache->wrap('calculate');
$result = $matrix([[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]) // [[8, 10, 12], [14, 16, 18]]

// Caching the result of printable contents using PHP echo.
if ($block = $cache->start($key)) {
	  ... printing some data ...

	  $block->end(); // save the output to the cache
}
```

> **NB:** The beta parameter found on cache methods default value is 1.0 and higher values mean earlier recompute. Set it to 0 to disable early recompute and set it to INF to force an immediate recompute:

📓 Documentation
---------------

[](#-documentation)

In-depth documentation on how to use this library can be found at [docs.biurad.com](https://docs.biurad.com/poakium/cache). It is also recommended to browse through unit tests in the [tests](./tests/) directory.

🙌 Sponsors
----------

[](#-sponsors)

If this library made it into your project, or you interested in supporting us, please consider [donating](https://biurad.com/sponsor) to support future development.

👥 Credits &amp; Acknowledgements
--------------------------------

[](#-credits--acknowledgements)

- [Divine Niiquaye Ibok](https://github.com/divineniiquaye) is the author this library.
- [All Contributors](https://github.com/biurad/php-cache/contributors) who contributed to this project.

📄 License
---------

[](#-license)

Poakium Cache is completely free and released under the [BSD 3 License](LICENSE).

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance64

Regular maintenance activity

Popularity17

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.4% 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 ~24 days

Recently: every ~13 days

Total

10

Last Release

2155d ago

PHP version history (2 changes)v0.1.0PHP ^7.1.3

v0.2.3PHP ^7.2

### Community

Maintainers

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

---

Top Contributors

[![divineniiquaye](https://avatars.githubusercontent.com/u/53147395?v=4)](https://github.com/divineniiquaye "divineniiquaye (147 commits)")[![renovate-bot](https://avatars.githubusercontent.com/u/25180681?v=4)](https://github.com/renovate-bot "renovate-bot (2 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (1 commits)")

---

Tags

biuradcachedoctrine-cachephppsr-16psr-6nettedoctrinecachecachingpsr6PHP7psr16biuradphp

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[phpfastcache/phpfastcache

PHP Abstract Cache Class - Reduce your database call using cache system. Phpfastcache handles a lot of drivers such as Apc(u), Cassandra, CouchBase, Couchdb, Dynamodb, Firestore, Mongodb, Files, (P)redis, Leveldb, Memcache(d), Ravendb, Ssdb, Sqlite, Wincache, Xcache, Zend Data Cache.

2.4k5.0M130](/packages/phpfastcache-phpfastcache)[matthiasmullie/scrapbook

Scrapbook is a PHP cache library, with adapters for e.g. Memcached, Redis, Couchbase, APCu, SQL and additional capabilities (e.g. transactions, stampede protection) built on top.

3212.5M32](/packages/matthiasmullie-scrapbook)[cache/doctrine-adapter

A PSR-6 cache implementation using Doctrine. This implementation supports tags

151.0M21](/packages/cache-doctrine-adapter)[kdyby/doctrine-cache

Doctrine Cache bridge for Nette Framework

101.3M19](/packages/kdyby-doctrine-cache)[apix/cache

A thin PSR-6 cache wrapper with a generic interface to various caching backends emphasising cache taggging and indexing to Redis, Memcached, PDO/SQL, APC and other adapters.

114542.8k6](/packages/apix-cache)[cache/cache-bundle

Symfony 2 bundle providing integration between PSR-6 compliant cache services and the framework. It supports cache for sessions, routing and Doctrine

43437.0k](/packages/cache-cache-bundle)

PHPackages © 2026

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