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

ActiveLibrary[Caching](/categories/caching)

modmore/revolution-cache
========================

A PSR-6 cache implementation to access the MODX Revolution Cache Provider.

2.0.0(3y ago)34.7k↓100%MITPHPPHP &gt;=8.0

Since Aug 30Pushed 3y ago3 watchersCompare

[ Source](https://github.com/modmore/RevolutionCache)[ Packagist](https://packagist.org/packages/modmore/revolution-cache)[ RSS](/packages/modmore-revolution-cache/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

RevolutionCache
===============

[](#revolutioncache)

A PSR-6 cache implementation to access the MODX Revolution Cache Provider.

This can be used to write custom application code against the PSR-6 caching standard, while integrating with the standard MODX 2.2+ Cache Manager. This offers access to the different cache implementations provided by MODX (file/memcached and others), and partition configuration through MODX System Settings.

RevolutionCache was developed for [Commerce](https://www.modmore.com/commerce/), but extracted into a standalone composer package to benefit others.

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

[](#installation)

Install RevolutionCache via [Composer](https://getcomposer.org):

```
composer require modmore/revolution-cache

```

License
-------

[](#license)

MIT

Usage
-----

[](#usage)

You can [read more about the PSR-6 Caching Interface Standard here](http://www.php-fig.org/psr/psr-6/).

A simple example of how you might use this adapter is as follows.

```
require_once '/path/to/vendor/autoload.php';

$pool = new \modmore\RevolutionCache\Pool($modx);

// Do some cache stuff
$item = $pool->getItem('my_value');
if ($item->isHit()) {
    echo 'Your number is ' . $item->get() . ' and was loaded from cache.';
}
else {
    $value = mt_rand(1, 9999);
    $item->set($value);
    if ($pool->save($item)) {
        echo 'Your number is ' . $value . ' and has been stored in the cache.';
    }
    else {
        echo 'Your number is ' . $value . ' but could not be written to cache';
    }
}
```

To use a partition other than `default`, you can specify it as the second option when creating the `$pool` instance:

```
$pool = new \modmore\RevolutionCache\Pool($modx, 'my_custom_partition');
```

The third `$options` property on the constructor can be used to specify xPDOCache options like the default expiry date, cache handler, and cache format, however it's recommended to configure this via MODX System Settings instead.

Notes
-----

[](#notes)

- This caching implementation does not support deferred saving: `$pool->saveDeferred()` is identical to `$pool->save()` and `$pool->commit()` is always true.
- This implementation does **not** support extensions to PSR-6 from the PHP-Cache project like tagging, namespaces or hierarchy.
- This implementation does support something similar to [namespaces from the PHP-Cache project](http://php-cache.readthedocs.io/en/latest/namespace/), by supporting what in MODX are called *Cache Partitions* or *Cache Providers*. When creating the Pool instance, you provide the partition name as the second parameter. Different partitions may have their own defaults for expiration time, caching driver, and the format in which they are stored. These are typically configured in the MODX System Settings, but may also be passed in the third `$options` property of the constructor.
- The modCacheManager supports cache key with directories (e.g. `users/10/messages`), however `/` is a reserved character with PSR-6, so you can **not** use those with this caching implementation. Instead you can use different partitions.

Tests
-----

[](#tests)

This implementation follows the PSR-6 spec as tested with the [PSR-6 integration tests provided by the PHP-Cache project](http://php-cache.readthedocs.io/en/latest/implementing-cache-pools/integration-tests/).

To run these tests, or to contribute to RevolutionCache:

1. Install MODX
2. Create a `config.core.php` file in the root of this project, pointing to the MODX core folder. There's an example in `config.core.sample.php`
3. Make sure dependencies are installed with `composer install`
4. Run `phpunit` from the project root.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity70

Established project with proven stability

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

Total

3

Last Release

1295d ago

Major Versions

0.2.1 → 2.0.02022-10-22

PHP version history (3 changes)0.2.0PHP &gt;5.4.4

0.2.1PHP &gt;=5.4.4

2.0.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/0085ccbe62590d6e3ecf3531b4b7f5815bca029095e41c4eb6632313761da54f?d=identicon)[mhamstra](/maintainers/mhamstra)

---

Top Contributors

[![Mark-H](https://avatars.githubusercontent.com/u/312944?v=4)](https://github.com/Mark-H "Mark-H (23 commits)")

---

Tags

modxphp-cache

### Embed Badge

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

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

###  Alternatives

[symfony/cache

Provides extended PSR-6, PSR-16 (and tags) implementations

4.2k348.9M2.5k](/packages/symfony-cache)[symfony/cache-contracts

Generic abstractions related to caching

2.4k308.9M198](/packages/symfony-cache-contracts)[tedivm/stash

The place to keep your cache.

9824.8M124](/packages/tedivm-stash)[league/flysystem-cached-adapter

An adapter decorator to enable meta-data caching.

35426.9M119](/packages/league-flysystem-cached-adapter)[laminas/laminas-cache

Caching implementation with a variety of storage options, as well as codified caching strategies for callbacks, classes, and output

1076.9M130](/packages/laminas-laminas-cache)[cache/adapter-common

Common classes for PSR-6 adapters

11124.4M37](/packages/cache-adapter-common)

PHPackages © 2026

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