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(5y 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 1mo 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 32% 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

2177d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/15091ba12470e0054da94a253c264751ef495c9897c59ea6837e986b31606e63?d=identicon)[remotelyliving](/maintainers/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

1076.9M130](/packages/laminas-laminas-cache)[desarrolla2/cache

Provides an cache interface for several adapters Apc, Apcu, File, Mongo, Memcache, Memcached, Mysql, Mongo, Redis is supported.

1322.5M47](/packages/desarrolla2-cache)[sabre/cache

Simple cache abstraction layer implementing PSR-16

541.2M3](/packages/sabre-cache)[cache/redis-adapter

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

523.9M27](/packages/cache-redis-adapter)[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)[cache/simple-cache-bridge

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

423.1M27](/packages/cache-simple-cache-bridge)

PHPackages © 2026

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