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

ActiveLibrary[Caching](/categories/caching)

mireiawen/cache
===============

A wrapper for the PhpFastCache caching backend

0.2.2(6y ago)040MITPHPPHP &gt;=7.3.0

Since Sep 22Pushed 4y ago1 watchersCompare

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

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

Cache
=====

[](#cache)

A wrapper for [PhpFastCache](https://www.phpfastcache.com/) caching backend, using its [PSR-16](https://www.php-fig.org/psr/psr-16/) implementation. This wrapper supports some of the more common drivers, as well as has the methods to read, write, delete and check for keys in the backend.

- Class: `Cache`
- Namespace: `Mireiawen\Cache`

Requirements
------------

[](#requirements)

- Cache backend
- PHP7

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

[](#installation)

You can clone or download the code from the [GitHub repository](https://github.com/Mireiawen/cache) or you can use composer: `composer require mireiawen/cache`

Methods
-------

[](#methods)

### \_\_construct

[](#__construct)

```
Cache::__construct(string $driver, array $config = [])

```

Set up the caching backend driver

#### Arguments

[](#arguments)

- **string** `$driver` - The cache backend driver to use, currently supported are:
    - files
    - memcache
    - memcached
    - redis
    - predis
- **array** `$config` - The backend specific configuration options
    - `files`:
        - `path` - The filesystem path where to store the cached data
    - `memcache`, `memcached`:
        - `host` - The hostname to connect to, defaults to `localhost`
        - `port` - The port to connect to, defaults to `11211`
    - `redis`, `predis`:
        - `host` - The hostname to connect to, defaults to `localhost`
        - `port` - The port to connect to, defaults to `6379`
        - `password` - The password to connect with, defaults to `NULL`
        - `database` - The database to use, defaults to `NULL`

#### Exceptions thrown

[](#exceptions-thrown)

##### PhpfastcacheDriverCheckException

[](#phpfastcachedrivercheckexception)

- On Driver errors

##### PhpfastcacheLogicException

[](#phpfastcachelogicexception)

- On PhpFastCache logic errors

##### \\Exception

[](#exception)

- In case of configuration errors

### Available

[](#available)

```
Cache::Available(string $id)

```

Check if the key exists in the cache backend

#### Arguments

[](#arguments-1)

- **string** `$id` - The cache ID to check for

#### Return value

[](#return-value)

- **bool** - TRUE if $id is cached, FALSE otherwise

#### Exceptions thrown

[](#exceptions-thrown-1)

##### PhpfastcacheSimpleCacheException

[](#phpfastcachesimplecacheexception)

- On cache errors

### Invalidate

[](#invalidate)

```
Cache::Invalidate(string $id)

```

Invalidate or delete the key from the cache backend

#### Arguments

[](#arguments-2)

- **string** `$id` - The cache ID to invalidate

#### Exceptions thrown

[](#exceptions-thrown-2)

##### PhpfastcacheSimpleCacheException

[](#phpfastcachesimplecacheexception-1)

- On cache errors

### Write

[](#write)

```
Cache::Write(string $id, mixed $value, int $ttl)

```

Store a value to the cache backend

#### Arguments

[](#arguments-3)

- **string** `$id` - The cache ID to store to
- **mixed** `$value` - The value to store to the cache
- **int** `$ttl` - The time to live for the cached item

#### Exceptions thrown

[](#exceptions-thrown-3)

##### PhpfastcacheSimpleCacheException

[](#phpfastcachesimplecacheexception-2)

- On cache errors

### Read

[](#read)

```
Cache::Read(string $id)

```

Retrieve a stored value from the cache backend

#### Arguments

[](#arguments-4)

- **string** `$id` - The cache ID to read from

#### Return value

[](#return-value-1)

- **mixed** - The stored value of the key

#### Exceptions thrown

[](#exceptions-thrown-4)

##### PhpfastcacheSimpleCacheException

[](#phpfastcachesimplecacheexception-3)

- On cache errors

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

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

Total

3

Last Release

2460d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0b939943c063fd46acb5c8cd353ed8f69511ea19527d9196a09c382e828847bc?d=identicon)[Mireiawen](/maintainers/Mireiawen)

---

Top Contributors

[![Mireiawen](https://avatars.githubusercontent.com/u/11092031?v=4)](https://github.com/Mireiawen "Mireiawen (5 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

### Embed Badge

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

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

###  Alternatives

[elgg/elgg

Elgg is an award-winning social networking engine, delivering the building blocks that enable businesses, schools, universities and associations to create their own fully-featured social networks and applications.

1.7k16.2k56](/packages/elgg-elgg)[beryllium/cachebundle

Provides an interface to Memcache for Symfony2 applications

32136.0k](/packages/beryllium-cachebundle)

PHPackages © 2026

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