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

ActiveLibrary[Caching](/categories/caching)

bentools/cache
==============

PSR-6 and PSR-16 Cache Adapters.

1.1(6y ago)02.6kMITPHPCI failing

Since Apr 15Pushed 6y ago1 watchersCompare

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

READMEChangelog (1)Dependencies (6)Versions (3)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/cdb8501e0f90aedee0f50d50da930ead2c293132d0e3eff2ffe8210d7c64c6de/68747470733a2f2f706f7365722e707567782e6f72672f62656e746f6f6c732f63616368652f762f737461626c65)](https://packagist.org/packages/bentools/cache)[![License](https://camo.githubusercontent.com/52e082e82e57f3bae011abe9207ddcc71c162dcb28f327afec0cbbd07a5274ce/68747470733a2f2f706f7365722e707567782e6f72672f62656e746f6f6c732f63616368652f6c6963656e7365)](https://packagist.org/packages/bentools/cache)[![Build Status](https://camo.githubusercontent.com/9e7bffa51771e33d26d6941831773a3e098b53b886a169ef16b7349dcdba17d2/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f62706f6c61737a656b2f63616368652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/bpolaszek/cache)[![Coverage Status](https://camo.githubusercontent.com/bf306221710b953876ad7f39f4584a31759c7942d34b3c5dc83023ae750b02df/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f62706f6c61737a656b2f63616368652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/bpolaszek/cache?branch=master)[![Quality Score](https://camo.githubusercontent.com/eea55f84217d0cfc0500647c8ecd75b12e131bcea498612efde7240357380328/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f62706f6c61737a656b2f63616368652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/bpolaszek/cache)[![Total Downloads](https://camo.githubusercontent.com/d5b74b9e976b0f1f18977ee7acecd6d79bda6bd3fda025675a0040482dbfefde/68747470733a2f2f706f7365722e707567782e6f72672f62656e746f6f6c732f63616368652f646f776e6c6f616473)](https://packagist.org/packages/bentools/cache)

bentools/cache
==============

[](#bentoolscache)

Usage
-----

[](#usage)

### Cache Fallback

[](#cache-fallback)

If calling a cache method throws an exception, it will fall back to the other cache pool.

```
use BenTools\Cache\Fallback\CacheFallback;
use Cache\Adapter\Memcache\MemcacheCachePool;
use Cache\Adapter\Redis\RedisCachePool;

$main = new RedisCachePool(new Redis());
$default = new MemcacheCachePool(new Memcache());
$cache = new CacheFallback($main, $default);
$cache->get('foo'); // if $main->get('foo') throws an exception, will call $default->get('foo')
```

You can use as many cache pools as you want, so that a failing cache falls back to the next healthy one:

```
use BenTools\Cache\Fallback\CacheFallback;
use Cache\Adapter\Memcache\MemcacheCachePool;
use Cache\Adapter\Redis\RedisCachePool;
use Cache\Adapter\PHPArray\ArrayCachePool;

$redis = new RedisCachePool(new Redis());
$memcache = new MemcacheCachePool(new Memcache());
$arrayCache = new ArrayCachePool();
$cache = new CacheFallback($redis, $memcache, $arrayCache);
$cache->get('foo');
```

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

[](#installation)

> composer require bentools/cache

Tests
-----

[](#tests)

> ./vendor/bin/phpunit

License
-------

[](#license)

MIT.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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

Total

2

Last Release

2265d ago

### Community

Maintainers

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

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[illuminate/contracts

The Illuminate Contracts package.

706130.3M13.3k](/packages/illuminate-contracts)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69735.1M159](/packages/algolia-algoliasearch-client-php)[moonshine/moonshine

Laravel administration panel

1.3k253.1k81](/packages/moonshine-moonshine)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[flow-php/etl

PHP ETL - Extract Transform Load - Abstraction

378604.0k104](/packages/flow-php-etl)

PHPackages © 2026

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