PHPackages                             firehed/redis-psr16 - 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. firehed/redis-psr16

ActiveLibrary[Caching](/categories/caching)

firehed/redis-psr16
===================

Redis implementation of PSR-16

0.5.0(3y ago)01.5k[3 PRs](https://github.com/Firehed/php-redis-psr16/pulls)MITPHPPHP ^8.0

Since Jun 2Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Firehed/php-redis-psr16)[ Packagist](https://packagist.org/packages/firehed/redis-psr16)[ RSS](/packages/firehed-redis-psr16/feed)WikiDiscussions main Synced today

READMEChangelog (6)Dependencies (5)Versions (10)Used By (0)

PSR-16 Redis
============

[](#psr-16-redis)

This is a Redis implementation for the [PSR-16](https://www.php-fig.org/psr/psr-16/) SimpleCache interface.

This library actually uses the multi-key operators supported by Redis (`mget`, etc), unlike most other implementations at the time of writing.

Installation and Usage
----------------------

[](#installation-and-usage)

Install: `composer require firehed/redis-psr16`

Usage:

```
$redis = new \Redis();
$redis->connect('yourhost', 6379);
$redis->auth(['user' => 'youruser', 'pass' => 'yourpass']);

$cache = new \Firehed\Cache\RedisPsr16($redis);
// Use like any other PSR-16 implementation
```

If `Redis::OPT_SERIALIZER` is not set (or uses the default `Redis::SERIALIZER_NONE`), this library will automatically set it to `Redis::SERIALIZER_PHP`. This will ensure that non-string values are stored and retreived correctly. Be aware that this means if any `object`s are cached, any magic methods related to serialization (`__sleep()`, `__wakeup()`, `__serialize()`, `__unserialize()`) will be called during caching operations. Setting that option to any other value before providing Redis to this library will use the set serializer:

```
use Firehed\Cache\RedisPsr16;
use Redis;

// Automatically sets SERIALIZER_PHP:
$redis = new Redis();
// connect/auth
$cache = new RedisPsr16($redis);

// Uses specified SERIALIZER_JSON
$redis = new Redis();
// connect/auth
$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_JSON);
$cache = new RedisPsr16($redis);
```

### Configuration

[](#configuration)

A runtime mode can be set via the `$mode` constructor parameter:

```
use Firehed\Cache\RedisPsr16;

$cache = new RedisPsr16($redis, RedisPsr16::MODE_THROW);
```

- `RedisPsr16::MODE_THROW` may throw exceptions on network issues (in the same way directly using the `Redis` extension can). Exceptions thrown will implement `Psr\SimpleCache\CacheException`, per PSR-16 requirements. This will help expose networking issues and may be beneficial for logging and error handling, but does require calling libraries to handle them. *This is the default mode.*
- `RedisPsr16::MODE_FAIL` will prevent exceptions from being thrown. Any error, including networking errors (where the `Redis` extension throws) will be treated as a failure. This could result in misleading behavior around cache misses; if it's important for your application to know the difference between "miss" and "Redis unavailable", do not use this mode.

The mode can be adjusted at runtime with `RedisPsr16::setMode($mode)`.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.7% 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 ~83 days

Recently: every ~104 days

Total

6

Last Release

1384d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/354842?v=4)[Eric Stern](/maintainers/Firehed)[@Firehed](https://github.com/Firehed)

---

Top Contributors

[![Firehed](https://avatars.githubusercontent.com/u/354842?v=4)](https://github.com/Firehed "Firehed (18 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")

---

Tags

rediscachecachingsimple-cachepsr-16mget

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/firehed-redis-psr16/health.svg)

```
[![Health](https://phpackages.com/badges/firehed-redis-psr16/health.svg)](https://phpackages.com/packages/firehed-redis-psr16)
```

###  Alternatives

[psr/simple-cache

Common interfaces for simple caching

8.1k727.3M2.1k](/packages/psr-simple-cache)[sabre/cache

Simple cache abstraction layer implementing PSR-16

541.2M3](/packages/sabre-cache)[voku/simple-cache

Simple Cache library

322.5M7](/packages/voku-simple-cache)[webarchitect609/bitrix-cache

Comfortable fluent interface for Bitrix cache. Anti-stampede cache protection.

2831.2k8](/packages/webarchitect609-bitrix-cache)

PHPackages © 2026

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