PHPackages                             remotelyliving/php-cache-adapter - 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. remotelyliving/php-cache-adapter

ActiveLibrary[Caching](/categories/caching)

remotelyliving/php-cache-adapter
================================

A lightweight PSR6 / PSR16 cache adapter library for common caching scenarios

1.0.0(6y ago)06[2 PRs](https://github.com/remotelyliving/php-cache-adapter/pulls)MITPHPPHP &gt;=7.4

Since May 23Pushed 3y ago1 watchersCompare

[ Source](https://github.com/remotelyliving/php-cache-adapter)[ Packagist](https://packagist.org/packages/remotelyliving/php-cache-adapter)[ RSS](/packages/remotelyliving-php-cache-adapter/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (9)Versions (4)Used By (0)

[![Build Status](https://camo.githubusercontent.com/6bd9864991c4ce352c421d4b5ab7b34a2f0f80315a45933cd65f2867bec88397/68747470733a2f2f7472617669732d63692e636f6d2f72656d6f74656c796c6976696e672f7068702d63616368652d616461707465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/remotelyliving/php-cache-adapter)[![Total Downloads](https://camo.githubusercontent.com/b95d9c5c830564e9335fbeb1b94ca8598ffb464b312cc569d81ca05df80523db/68747470733a2f2f706f7365722e707567782e6f72672f72656d6f74656c796c6976696e672f7068702d63616368652d616461707465722f646f776e6c6f616473)](https://packagist.org/packages/remotelyliving/php-cache-adapter)[![Coverage Status](https://camo.githubusercontent.com/cfbfd0d6fa496d7e31f36f704daeab01143b7a8efb92b04fdb19f5af7dd3ae3c/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f72656d6f74656c796c6976696e672f7068702d63616368652d616461707465722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/remotelyliving/php-cache-adapter?branch=master)[![License](https://camo.githubusercontent.com/a34b3f58c201339c95fc028b3747b1388f852ced39bc174d85bc4d265a341637/68747470733a2f2f706f7365722e707567782e6f72672f72656d6f74656c796c6976696e672f7068702d63616368652d616461707465722f6c6963656e7365)](https://packagist.org/packages/remotelyliving/php-cache-adapter)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/0c7a3d4c3028343b48cdfbea4165f6046656b501ef13df8254476fe9703d7055/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f72656d6f74656c796c6976696e672f7068702d63616368652d616461707465722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/remotelyliving/php-cache-adapter/?branch=master)

php-cache-adapter:
==================

[](#php-cache-adapter)

### 💰 A PSR-6 and PSR-16 Cache Implementation For PHP 💰

[](#-a-psr-6-and-psr-16-cache-implementation-for-php-)

### Use Cases

[](#use-cases)

If you want a lightweight, no frills PSR-6 / PSR-16 cache Memcache, Redis, or Memory adapter, this is for you. This library as born out of the idea that many other libraries offer way too much functionality for cache adapters and end up being overly complex or underperformant.

This library seeks to address the three most common cache storage mechanisms in the PHP ecosystem and not much more.

### Installation

[](#installation)

```
composer require remotelyliving/php-cache-adapter
```

### Usage

[](#usage)

#### [SimpleCache](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-16-simple-cache.md)

[](#simplecache)

Simple Cache is the PSR-16 implementation of a simple cache adapter. Below are the different adapters you can create and use.

```
// Memcached flavor Simple Cache
$memcached = new \Memcached();
$memcached->addServer($memcacheHost, $memcachePort);
$memcachedAdapter = RemotelyLiving\PHPCacheAdapter\SimpleCache\Memcached::create($memcached);

// Redis Simple Cache
$redis = new \Redis();
$redis->pconnect($redisHost, $redisPort, $timeout);
$redisAdapter = RemotelyLiving\PHPCacheAdapter\SimpleCache\Redis::create($redis);

// Memory / Runtime Simple Cache
$memoryAdapter = RemotelyLiving\PHPCacheAdapter\SimpleCache\Memory::create($maxItemsForArray); // can set max items to keep in array

// APCu
$apcu = RemotelyLiving\PHPCacheAdapter\SimpleCache\APCu::create();

// Chain adapter calls through all adapters until values are found in order of FIFO
// so here we would check memory first, then Memcache, then Redis
$chainAdapter = RemotelyLiving\PHPCacheAdapter\SimpleCache\Chain::create($memoryAdapter, $memcachedAdapter, $redisAdapter);
```

#### [CacheItemPool](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-6-cache.md)

[](#cacheitempool)

Cache Item Pool is the PSR-6 implementation this library provides. You can create a CacheItemPool with a cache extension OR any of the PSR-16 Simple Cache adapters.

```
$memcached = new \Memcached();
$memcached->addServer('127.0.0.1', 11211);

$redis = new \Redis();
$redis->pconnect('127.0.0.1', 6379, 30);

$memcacheCacheItemPool = RemotelyLiving\PHPCacheAdapter\CacheItemPool\CacheItemPool::createMemcached($memcached, 'namespace');
// OR
$redisCacheItemPool = RemotelyLiving\PHPCacheAdapter\CacheItemPool\CacheItemPool::createRedis($redis, 'namespace');
// OR
$inMemoryCacheItemPool = RemotelyLiving\PHPCacheAdapter\CacheItemPool\CacheItemPool::createMemory($maxItems, 'namespace');
// OR
$apcuCacheItemPool = RemotelyLiving\PHPCacheAdapter\CacheItemPool\CacheItemPool::createAPCu();
// OR
$cacheItemPool = RemotelyLiving\PHPCacheAdapter\CacheItemPool\CacheItemPool::createFromSimpleCache($chainAdapter, 'namespace');
// OR
$chain = RemotelyLiving\PHPCacheAdapter\CacheItemPool\ChainBuilder::create('namespace', 300)
    ->addMemory()
    ->addAPCu()
    ->addMemcached($memcached)
    ->addRedis($redis)
    ->build();
```

#### Future Development

[](#future-development)

- Consider adding a filesystem storage mechanism

###  Health Score

24

—

LowBetter than 30% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

2277d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2728347?v=4)[Christian Thomas](/maintainers/remotelyliving)[@remotelyliving](https://github.com/remotelyliving)

---

Tags

rediscachepsr-16psr-6apcumemcachecache adapter

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/remotelyliving-php-cache-adapter/health.svg)

```
[![Health](https://phpackages.com/badges/remotelyliving-php-cache-adapter/health.svg)](https://phpackages.com/packages/remotelyliving-php-cache-adapter)
```

###  Alternatives

[laminas/laminas-cache

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

1087.5M157](/packages/laminas-laminas-cache)[sabre/cache

Simple cache abstraction layer implementing PSR-16

551.3M5](/packages/sabre-cache)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.8M672](/packages/shopware-core)[cache/redis-adapter

A PSR-6 cache implementation using Redis (PhpRedis). This implementation supports tags

534.2M27](/packages/cache-redis-adapter)[cache/simple-cache-bridge

A PSR-6 bridge to PSR-16. This will make any PSR-6 cache compatible with SimpleCache.

423.4M28](/packages/cache-simple-cache-bridge)[cache/apcu-adapter

A PSR-6 cache implementation using apcu. This implementation supports tags

173.2M23](/packages/cache-apcu-adapter)

PHPackages © 2026

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