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

Abandoned → [amber/cache](/?search=amber%2Fcache)ArchivedLibrary[Caching](/categories/caching)

amber/cache
===========

Simple Cache.

v1.0.4-beta(6y ago)11.3kGPL-3.0-or-laterPHPPHP &gt;=7.2.0

Since May 22Pushed 6y agoCompare

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

READMEChangelog (5)Dependencies (9)Versions (11)Used By (0)

[![GitHub last commit](https://camo.githubusercontent.com/bcd08b0bc0c0c110f659127e77bf1d3b23a7357b888ebb48199770a4f9876c0e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f73797374656d736f6e2f63616368652e737667)](https://camo.githubusercontent.com/bcd08b0bc0c0c110f659127e77bf1d3b23a7357b888ebb48199770a4f9876c0e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f73797374656d736f6e2f63616368652e737667)[![Latest Stable Version](https://camo.githubusercontent.com/a662397702efce78e40474cee3632f0638a5db49adf9d0bfef3db415b10065cc/68747470733a2f2f706f7365722e707567782e6f72672f616d6265722f63616368652f762f737461626c652e706e67)](https://packagist.org/packages/amber/cache)[![Latest Beta Version](https://camo.githubusercontent.com/d9876ae9e7323bb228ed9d4ba8289271e6c81b6a1fd3dfa0a64643312df45675/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f767072652f616d6265722f63616368652e737667)](https://packagist.org/packages/amber/cache)[![PHP from Packagist](https://camo.githubusercontent.com/22fb48dea974f50596782181e6eb8abac0b2cc6795842ba4b59e3a11152a2122/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f616d6265722f63616368652e737667)](https://camo.githubusercontent.com/22fb48dea974f50596782181e6eb8abac0b2cc6795842ba4b59e3a11152a2122/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f616d6265722f63616368652e737667)[![Build Status](https://camo.githubusercontent.com/144ac31d64e063aa204ee88c540e10d3bc0e9b7aa427a16510fb6ebc4cd3466a/68747470733a2f2f7472617669732d63692e6f72672f73797374656d736f6e2f63616368652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/systemson/cache)[![Coverage Status](https://camo.githubusercontent.com/19bbce2ca9cc97b6bc577ce77bfd77591b9a3f1e76c1df59e63f815408c6d044/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f73797374656d736f6e2f63616368652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/systemson/cache?branch=master)[![Total Downloads](https://camo.githubusercontent.com/8de26c99d7869985ec421c701bf97a3a040a960134bffdbe31fe6762c3d7da6f/68747470733a2f2f706f7365722e707567782e6f72672f616d6265722f63616368652f646f776e6c6f6164732e706e67)](https://packagist.org/packages/amber/cache)[![GitHub](https://camo.githubusercontent.com/c50b9e95346169e35cbf30f3b2f6cabe7fea7235ad3b8f53c95134506b413fcb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f73797374656d736f6e2f63616368652e737667)](https://camo.githubusercontent.com/c50b9e95346169e35cbf30f3b2f6cabe7fea7235ad3b8f53c95134506b413fcb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f73797374656d736f6e2f63616368652e737667)

Amber/Cache
===========

[](#ambercache)

Simple and fast cache system implementing PSR-16: interface for caching libraries

Getting started
---------------

[](#getting-started)

### Installation

[](#installation)

With Composer

```
$ composer require amber/cache

```

API Usage
---------

[](#api-usage)

```
use Amber\Cache\Cache;

$cache = Cache::getInstance();
```

### Drivers

[](#drivers)

Alternatively you can set the driver before geting the instance of the cache.

```
use Amber\Cache\Cache;

$cache = Cache::driver('file');
```

You can choose from these drivers:

```
$drivers = [
    'file'  => 'Amber\Cache\Driver\SimpleCache',
    'json'  => 'Amber\Cache\Driver\JsonCache',
    'array' => 'Amber\Cache\Driver\ArrayCache',
    'apcu'  => 'Amber\Cache\Driver\ApcuCache',
];
```

Or you could set the driver class:

```
$cache = Cache::driver(Amber\Cache\Driver\SimpleCache::class);
```

Finally you could instantiate the driver by yourself:

```
$cache = new \Amber\Cache\Driver\SimpleCache();
```

### get()

[](#get)

Fetches a value from the cache.

```
$cache->get($key, $default = null);
```

### set()

[](#set)

Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time.

```
$cache->set($key, $value, $ttl = null);
```

### delete()

[](#delete)

Delete an item from the cache by its unique key.

```
$cache->delete($key);
```

### clear()

[](#clear)

Wipes clean the entire cache's keys.

```
$cache->clear();
```

### has()

[](#has)

Determines whether an item is present in the cache.

```
$cache->has($key);
```

Multiple actions
----------------

[](#multiple-actions)

### getMultiple()

[](#getmultiple)

Obtains multiple cache items by their unique keys.

```
$cache->getMultiple($keys, $default = null);
```

### setMultiple()

[](#setmultiple)

Persists a set of key =&gt; value pairs in the cache, with an optional TTL.

```
$cache->setMultiple($values, $ttl = null);
```

### deleteMultiple()

[](#deletemultiple)

Deletes multiple cache items in a single operation.

```
$cache->deleteMultiple($keys);
```

### Static Usage

[](#static-usage)

You can use all the method from the Cache class statically, like this:

```
use Amber\Cache\Cache;

Cache::set('key', 'value');

Cache::has('key'); // Returns true

Cache::get('key'); // Returns "value"

Cache::delete('key');

// Set the driver and then call the desired method.
Cache::driver('json')->set('key', 'value');
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 77.2% 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 ~44 days

Recently: every ~18 days

Total

10

Last Release

2515d ago

Major Versions

v0.1.4-beta → v1.0.0-beta2019-04-10

PHP version history (2 changes)v0.1.0-betaPHP &gt;=7.0.0

v1.0.0-betaPHP &gt;=7.2.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/1912ffd7709c7c3d7498921fd3080e23589e5cee9fb84a4d3831126739ac85b5?d=identicon)[systemson](/maintainers/systemson)

---

Top Contributors

[![systemson](https://avatars.githubusercontent.com/u/32528630?v=4)](https://github.com/systemson "systemson (88 commits)")[![milanegrin](https://avatars.githubusercontent.com/u/82895394?v=4)](https://github.com/milanegrin "milanegrin (14 commits)")[![devilu](https://avatars.githubusercontent.com/u/25694532?v=4)](https://github.com/devilu "devilu (12 commits)")

---

Tags

cachepsr-16

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[symfony/cache

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

4.2k348.9M2.5k](/packages/symfony-cache)[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.4M38](/packages/cache-adapter-common)[cache/cache

Library of all the php-cache adapters

2712.7M22](/packages/cache-cache)[cache/filesystem-adapter

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

705.8M82](/packages/cache-filesystem-adapter)[cache/array-adapter

A PSR-6 cache implementation using a php array. This implementation supports tags

548.3M151](/packages/cache-array-adapter)

PHPackages © 2026

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