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

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

bravo3/cache
============

A PHP 5.4 cache interface and various implementations including Redis and Bravo3/ORM

0.1.4(10y ago)17.6k12MITPHPPHP &gt;=5.4.0

Since Mar 30Pushed 10y ago1 watchersCompare

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

READMEChangelog (2)Dependencies (4)Versions (6)Used By (2)

Cache Interface
===============

[](#cache-interface)

This is a PHP 5.4 caching interface with implementations for common key/value storage engines.

PSR Proposal
------------

[](#psr-proposal)

The interfaces in this library abide by the current PSR-6 draft for caching interfaces. It should be known that should PHP-FIG adopt a PSR standard for caching interfaces, the interfaces in this library will be replaced with the PSR standard.

More info:

- [Crell Proposal - Main](https://github.com/Crell/fig-standards/blob/Cache/proposed/cache.md)
- [Crell Proposal - Cache Meta](https://github.com/Crell/fig-standards/blob/Cache/proposed/cache-meta.md)

Subject To Change
-----------------

[](#subject-to-change)

The approach taken follows the 'strong item' or 'repository model' as per the above meta documentation. Should the PSR standard pass, there will be minimal change. Should an alternative approach pass, much of this library - and any implementations based on the interfaces - will need to be refactored.

A new major version number will be applied to this library when PSR-6 passes.

Usage
=====

[](#usage)

Basic usage:

```
$pool = new RedisCachePool('tcp://10.0.0.1:6379');
$item = $pool->get('foo');

$item->get();       // Pull the value from the database
$item->isHit();     // Check if the retrieval was a cache hit

$item->exists();    // Check if the entry exists in the datbase (MAY avoid actually retrieving the value)

$item->set('bar');  // Save to cache
$item->delete();    // Remove from cache

$items = $pool->getItems(['test1', 'test2', 'test3']);  // Get a collection of items

```

Using a TTL can be done with a `\DateTime` object or a integer offset in seconds:

```
$item = $pool->getItem('foo');

$dt = new \DateTime();
$dt->modify('+10 seconds');

$item->set('bar', $dt);   // Set TTL with a \DateTime object
$item->set('bar', null);  // Clear the TTL, item never expires
$item->set('bar', 10);    // Set the TTL to 10 seconds

```

Implementations
===============

[](#implementations)

Ephemeral
---------

[](#ephemeral)

The ephemeral implementation is a single-session storage that loses it's data when the session ends. This is useful for testing or a default implementation in lack of a real cache storage device. Or if you just really don't care about the volatility of your data.

Redis
-----

[](#redis)

Redis support is fully integrated via the Predis library.

To enable Redis support:

```
composer require predis/predis

```

Bravo3/ORM
----------

[](#bravo3orm)

You can use any Bravo3/ORM driver to connect a cache connection, this is useful to maintain a single source to your database.

To enable ORM support:

```
composer require bravo3/orm

```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.9% 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 ~147 days

Total

5

Last Release

3839d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0a82084f38dfacd80655e26cd45b5bb9ab43eaa09b3a97c5c4a2350fe41b0c20?d=identicon)[jordonsc](/maintainers/jordonsc)

---

Top Contributors

[![jordonsc](https://avatars.githubusercontent.com/u/347611?v=4)](https://github.com/jordonsc "jordonsc (8 commits)")[![rickymcalister](https://avatars.githubusercontent.com/u/393500?v=4)](https://github.com/rickymcalister "rickymcalister (1 commits)")

---

Tags

ormrediscachepredis

###  Code Quality

TestsPHPUnit

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/bravo3-cache/health.svg)](https://phpackages.com/packages/bravo3-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)[mostafaznv/laracache

LaraCache is a customizable cache trait to cache queries on model's events

27246.8k1](/packages/mostafaznv-laracache)[ymigval/laravel-model-cache

Laravel package for caching Eloquent model queries

7642.2k3](/packages/ymigval-laravel-model-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)[cycle/database

DBAL, schema introspection, migration and pagination

64690.9k31](/packages/cycle-database)[endeveit/cache

Simple caching library with support for tags.

1711.1k](/packages/endeveit-cache)

PHPackages © 2026

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