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

ActiveLibrary[Caching](/categories/caching)

terah/redis-cache
=================

A very simple redis caching lib with hierarchical keys

8.0.0.0(10mo ago)06561MITPHPPHP &gt;=8.0

Since Dec 17Pushed 10mo agoCompare

[ Source](https://github.com/terah/redis-cache)[ Packagist](https://packagist.org/packages/terah/redis-cache)[ Docs](https://github.com/terah/redis-cache)[ RSS](/packages/terah-redis-cache/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (101)Used By (1)

redis-cache
===========

[](#redis-cache)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e2483187058b0928809bfc10db4102bade1f8528212d08d401981b9628455037/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f74657261682f72656469732d63616368652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/terah/redis-cache)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/aae6e916c9dbcce35dfa1df4f21b9c1ca91cb6baa6593bd4b810e988db62e7f7/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f74657261682f72656469732d63616368652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/terah/redis-cache)[![Coverage Status](https://camo.githubusercontent.com/60566c07bd9d220e87f4dc63857c50c02eec26b9cd16f5f3365b32b37b1c56af/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f74657261682f72656469732d63616368652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/terah/redis-cache/code-structure)[![Quality Score](https://camo.githubusercontent.com/44bd6f4658834f62b9fee65eaa4644f1edfd716c95ce8ed9db7381a31bd4f945/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f74657261682f72656469732d63616368652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/terah/redis-cache)[![Total Downloads](https://camo.githubusercontent.com/aeebaf409f925050746955814f1f0ab7371b70152ccffed228695052be12b37a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f74657261682f72656469732d63616368652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/terah/redis-cache)

Super simple redis caching implementation.

Install
-------

[](#install)

Via Composer

```
$ composer require terah/redis-cache
```

Usage
-----

[](#usage)

```
$redis          = new \Redis();
$redis->connect('127.0.0.1', 6379);

$namespace      = 'my-short-db-cache';
$defaultTtl     = 60 * 60; // 1 hour
$cache          = new Terah\RedisCache\RedisCache($redis, $defaultTtl, $namespace);

// Save your data
$cache->set('my-user-list', expensiveFunctionCall(), 60 * 60 * 2); // Ttl will default to $defaultTtl

// Fetch your data
$myData         = $cache->get('my-user-list');

// Deletes
$cache->delete('my-user-list');

// Convenient callback handler
$callback = function() {
    return expensiveDataFetch();
}
$data = $cache->remember('my-user-list', $callback, 60 * 60 * 1);

// Hierarchical keys - caching in 'directories'

$cache->set('/user_data/user_profiles/freddy', $data);
$cache->set('/user_data/user_profiles/betty', $data);
$cache->set('/user_data/user_profiles/micky', $data);

// now you can flush all user data:
$cache->delete('/user_data/');
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- \[Terry Cullen\]\[\]
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance54

Moderate activity, may be stable

Popularity15

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity84

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 53.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 ~36 days

Recently: every ~419 days

Total

100

Last Release

317d ago

Major Versions

2.0.0.4 → 3.0.0.02018-02-03

3.0.0.3 → 4.0.0.52018-05-04

4.0.7.3 → 5.0.0.32019-11-05

5.0.0.7 → 6.0.0.72021-01-15

6.0.0.9 → 8.0.0.02025-08-20

PHP version history (4 changes)1.0.0PHP &gt;=5.5.0

2.0.0.0PHP &gt;=7.0

6.0.0.7PHP &gt;=7.4

8.0.0.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/13de50ce12f8fef19ca345899735b089bd9a535aaf93d1f40eacb9726c60cd0e?d=identicon)[terah](/maintainers/terah)

---

Top Contributors

[![terah](https://avatars.githubusercontent.com/u/2120322?v=4)](https://github.com/terah "terah (22 commits)")[![uqcullen](https://avatars.githubusercontent.com/u/65157728?v=4)](https://github.com/uqcullen "uqcullen (19 commits)")

---

Tags

redis-cacheterah

### Embed Badge

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

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

###  Alternatives

[swayok/alternative-laravel-cache

Replacements for Laravel's redis and file cache stores that properly implement tagging idea. Powered by cache pool implementations provided by http://www.php-cache.com/

202583.7k8](/packages/swayok-alternative-laravel-cache)[rtcamp/nginx-helper

Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also provides cloudflare edge cache purging with Cache-Tags.

23617.1k1](/packages/rtcamp-nginx-helper)[iazaran/smart-cache

Smart Cache is a caching optimization package designed to enhance the way your Laravel application handles data caching. It intelligently manages large data sets by compressing, chunking, or applying other optimization strategies to keep your application performant and efficient.

21111.6k](/packages/iazaran-smart-cache)[beryllium/cachebundle

Provides an interface to Memcache for Symfony2 applications

33136.2k](/packages/beryllium-cachebundle)

PHPackages © 2026

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