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

ActiveLibrary[Caching](/categories/caching)

mimatus/export-cache
====================

PSR-6 Cache without deserialization speeded-up with OPcache

00PHP

Since Aug 5Pushed 3y ago1 watchersCompare

[ Source](https://github.com/MiMatus/Export-Cache)[ Packagist](https://packagist.org/packages/mimatus/export-cache)[ RSS](/packages/mimatus-export-cache/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

MiMatus\\ExportCache
====================

[](#mimatusexportcache)

**PSR-6 Cache without deserialization speeded-up with OPcache**

This cache package aim to target small niche use-cases when deserialization of stored data can have significant performance impact and when data stored in cache are updated rarely (or never, mainly because of write [performance](#performance)).

🛠 Installation
--------------

[](#-installation)

```
composer require mimatus/export-cache
```

It's highly recommanded to enable OPcache for best [performance](#performance)

Usage
-----

[](#usage)

### Use when ...

[](#use-when-)

- [OPcache](https://www.php.net/manual/en/book.OPcache.php) is enabled
- cached data are rarely changing (too frequent changes might lead to periodical reset of the OPcache memory)
- needs cache shared by PHP processes

### Don't use when...

[](#dont-use-when)

- basically in any other use-case which is not in [Use when ... section](#use-when) 😅

### Example

[](#example)

```
use MiMatus\ExportCache\ExportCache;

$storagePath = sys_get_temp_dir() . \DIRECTORY_SEPARATOR . 'export-cache';
$cache = new ExportCache($storagePath);
$closure = function () {
    return 'data'
};

$cache->set('key0', 'data', new DateInterval('P1D'));
$cache->set('key1', ['data']);
$cache->set('key2', $closure);
$cache->set('key3', 'expired data', new DateInterval('P1S'));

sleep(2);

assert($cache->get('key0') === 'data');
assert($cache->get('key1') === ['data']);
assert($cache->get('key2')() === 'data');
assert($cache->get('key3') === null);
```

### Data limitations

[](#data-limitations)

Thanks to [brick/varexporter](https://github.com/brick/varexporter) which is used for data serialization, it's possible to cache almost any PHP value, even closures, however with some [limitations](https://github.com/brick/varexporter#limitations):

- PHP Internal objects - SplFileInfo, XMLReader, etc.
- objects with circular references
- annonymous classes
- eval()'d or same line declared Closures, [more info](https://github.com/brick/varexporter#caveats)

Concurrency
-----------

[](#concurrency)

- Dirty Reads
- Lost Updates
- Phantom read
- Non-repeatable Reads - WIP

Performance - WIP
-----------------

[](#performance---wip)

Read [![](bench-read.png)](bench-read.png)Write [![](bench-write.png)](bench-write.png)To see full results use:

```
make build
make benchmark
```

`Requires: docker`

💌 Credits
---------

[](#-credits)

- serialization - [brick/varexporter](https://github.com/brick/varexporter)

Similar projects
----------------

[](#similar-projects)

- [Symfony's PHPFileAdapter](https://github.com/symfony/cache/blob/6.3/Adapter/PhpFilesAdapter.php)

###  Health Score

13

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity22

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/52460843?v=4)[Michal Matúš](/maintainers/MiMatus)[@MiMatus](https://github.com/MiMatus)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[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.

21114.2k](/packages/iazaran-smart-cache)[phpfastcache/phpssdb

PHP SSDB Driver for phpFastCache

14736.9k1](/packages/phpfastcache-phpssdb)[rapidwebltd/rw-file-cache

RW File Cache is a PHP File-based Caching Library. Its syntax is designed to closely resemble the PHP memcache extension.

15196.8k7](/packages/rapidwebltd-rw-file-cache)[yuzuru-s/redis-recommend

Wrapping Redis's sorted set APIs for specializing recommending operations.

392.9k](/packages/yuzuru-s-redis-recommend)[ichhabrecht/intcache

Turn uncachable page objects into cacheable links

193.9k](/packages/ichhabrecht-intcache)

PHPackages © 2026

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