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

AbandonedArchivedLibrary[Caching](/categories/caching)

userfrosting/cache
==================

Cache module for UserFrosting

4.5.0(5y ago)245.1k↓73.3%[1 issues](https://github.com/userfrosting/cache/issues)MITPHPPHP &gt;=7.1

Since Jun 19Pushed 5y ago3 watchersCompare

[ Source](https://github.com/userfrosting/cache)[ Packagist](https://packagist.org/packages/userfrosting/cache)[ Docs](https://github.com/userfrosting/Cache)[ RSS](/packages/userfrosting-cache/feed)WikiDiscussions master Synced 3w ago

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

Cache module for UserFrosting 4
===============================

[](#cache-module-for-userfrosting-4)

[![Latest Version](https://camo.githubusercontent.com/6f585046ab4dacec1bcecf26cb7b851e9c31a2de1c99a7d423233c50eea30119/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f7573657266726f7374696e672f63616368652e737667)](https://github.com/userfrosting/cache/releases)[![Software License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE.md)[![Join the chat at https://chat.userfrosting.com/channel/support](https://camo.githubusercontent.com/3ef275424b9a67f2277aea0eeb294f16f16660d8fc4073a0a988298d626d4c5a/68747470733a2f2f636861742e7573657266726f7374696e672e636f6d2f6170692f76312f736869656c642e7376673f6e616d653d5573657246726f7374696e67)](https://chat.userfrosting.com/channel/support)[![Donate](https://camo.githubusercontent.com/9b77bd2b1b19b6b8fcbff67c4cfa703b0ab2c936b33ce26d534e1222cbdcdea6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4f70656e253230436f6c6c6563746976652d446f6e6174652d626c75652e737667)](https://opencollective.com/userfrosting#backer)

BranchBuildCoverageStyle[master](https://github.com/userfrosting/cache)[![](https://github.com/userfrosting/cache/workflows/Build/badge.svg?branch=master)](https://github.com/userfrosting/cache/actions?query=workflow%3ABuild)[![](https://camo.githubusercontent.com/ddce389f9633874a3151170d4f3a620dd3bdc8a5e3a360bdd9b1da49afa8fb7d/68747470733a2f2f636f6465636f762e696f2f67682f7573657266726f7374696e672f63616368652f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/userfrosting/cache)[![](https://camo.githubusercontent.com/c311265f9be2c2eca396d746777c4a415e0d8bbc162c6d99e4d1bb2af45d4af8/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f38323335373035382f736869656c643f6272616e63683d6d6173746572267374796c653d666c6174)](https://github.styleci.io/repos/82357058)[develop](https://github.com/userfrosting/cache/tree/develop)[![](https://github.com/userfrosting/cache/workflows/Build/badge.svg?branch=develop)](https://github.com/userfrosting/cache/actions?query=workflow%3ABuild) [![](https://camo.githubusercontent.com/a8ed13a67dd28e72deda06a54d12397b871f53aa2f5d249f33c14b6655735dac/68747470733a2f2f636f6465636f762e696f2f67682f7573657266726f7374696e672f63616368652f6272616e63682f646576656c6f702f67726170682f62616467652e737667)](https://codecov.io/gh/userfrosting/cache)[![](https://camo.githubusercontent.com/43d9ae4ee1096b660915e0475c85d1729d53bbbb8f08b9ce240a05d8b30cf23b/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f38323335373035382f736869656c643f6272616e63683d646576656c6f70267374796c653d666c6174)](https://github.styleci.io/repos/82357058)Louis Charette, 2017

Wrapper function for *Laravel cache system* for easier integration of the cache system in standalone projects. Refer to [Laravel documentation](https://laravel.com/docs/5.4/cache) for all cache related function. This wrapper support Laravel `ArrayStore`, `FileStore`, `MemcachedStore` and `RedisStore`.

Also include a `namespace` parameter to handle multiple cache instance on the same server or project.

Usage
-----

[](#usage)

For any store driver, you first need to create a new `*Store`, passing the config values for each of those stores. Once a new store instantiated, you need to use the `instance` function to get the *cache instance*.

To use one of the following stores, you first need to include add it to the `use` list of your class or php file.

If you need to use multiple cache instance on the same server (especially for Memcached and Redis drivers) or on the same project (for example, user based cache), you can use the `namespace` parameter in the `*Store` constructor. A namespace should always be a *string*.

Since he *Laravel cache* requires an instance of `Illuminate\Container\Container`, every `*Store` in this package will create one automatically. If you want to reuse an existing `Container`, you can pass it to the `*Store` constructor.

While the `namespace` parameter is required for any `*Store`, all other parameters are optional, unless otherwise specified.

### ArrayStore

[](#arraystore)

The [ArrayStore](https://laravel.com/api/5.4/Illuminate/Cache/ArrayStore.html) is a dummy store that doesn't really save anything. This can be used if you want to disable cache globally.

The `ArrayStore` accepts the `namespace` and `Container` parameters: `new ArrayStore(string $namespace, Illuminate\Container\Container $app = null);`

*Example :*

```
use UserFrosting\Cache\ArrayStore;

...

$cacheStore = new ArrayStore("global");
$cache = $cacheStore->instance();

$cache->get(...);

```

### FileStore

[](#filestore)

The [FileStore](https://laravel.com/api/5.4/Illuminate/Cache/FileStore.html) save file to the filesystem.

The `FileStore` accepts the `namespace`, `path` and `Container` parameters : `new FileStore(string $namespace, string $path = "./", Illuminate\Container\Container $app = null);`

*Example :*

```
use UserFrosting\Cache\FileStore;

...

$cacheStore = new FileStore("global", "./cache");
$cache = $cacheStore->instance();

$cache->get(...);

```

### MemcachedStore

[](#memcachedstore)

The [MemcachedStore](https://laravel.com/api/5.4/Illuminate/Cache/MemcachedStore.html) uses [Memcached](http://www.memcached.org) to efficiently handle caching.

> **Memcached** should't be mistaken for the **Memcache**. Those are tow separate things !

The `MemcachedStore` accepts the `namespace`, `config` and `Container` parameters : `new MemcachedStore(string $namespace, array $config = [], Illuminate\Container\Container $app = null);`

Memcached config's array contain the settings for your Memcached instance. Default values are:

```
[
  'host' => '127.0.0.1',
  'port' => 11211,
  'weight' => 100
]

```

Custom config can be overwritten using this parameter.

*Example :*

```
use UserFrosting\Cache\MemcachedStore;

...

$cacheStore = new MemcachedStore("global"); //Uses default Memcached settings
$cache = $cacheStore->instance();

$cache->get(...);

```

*Example with custom server and port :*

```
use UserFrosting\Cache\MemcachedStore;

...

$cacheStore = new MemcachedStore("global", [
  'host' => '123.456.789.0',
  'port' => '22122'
]);
$cache = $cacheStore->instance();

$cache->get(...);

```

### RedisStore

[](#redisstore)

The [RedisStore](https://laravel.com/api/5.4/Illuminate/Cache/RedisStore.html) uses [Redis server](https://redis.io) to efficiently handle caching.

The `RedisStore` accepts the `namespace`, `config` and `Container` parameters : `new RedisStore(string $namespace, array $config = [], Illuminate\Container\Container $app = null);`

Redis config's array contain the settings for your Redis server. Default values are:

```
[
  'host' => '127.0.0.1',
  'password' => null,
  'port' => 6379,
  'database' => 0
]

```

Custom config can be overwritten using this parameter.

*Example :*

```
use UserFrosting\Cache\RedisStore;

...

$cacheStore = new RedisStore("global"); //Uses default Redis settings
$cache = $cacheStore->instance();

$cache->get(...);

```

*Example with custom port and password :*

```
use UserFrosting\Cache\RedisStore;

...

$cacheStore = new RedisStore("global", [
  'password' => 'MyAwesomePassword',
  'port' => '1234'
]);
$cache = $cacheStore->instance();

$cache->get(...);

```

[Style Guide](STYLE-GUIDE.md)
-----------------------------

[](#style-guide)

[Testing](RUNNING_TESTS.md)
---------------------------

[](#testing)

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 93.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 ~175 days

Recently: every ~167 days

Total

9

Last Release

1889d ago

PHP version history (2 changes)4.1.0PHP &gt;=5.6.0

4.3.0PHP &gt;=7.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5004534?v=4)[Alex Weissman](/maintainers/alexweissman)[@alexweissman](https://github.com/alexweissman)

---

Top Contributors

[![lcharette](https://avatars.githubusercontent.com/u/2566513?v=4)](https://github.com/lcharette "lcharette (70 commits)")[![Silic0nS0ldier](https://avatars.githubusercontent.com/u/17376090?v=4)](https://github.com/Silic0nS0ldier "Silic0nS0ldier (4 commits)")[![alexweissman](https://avatars.githubusercontent.com/u/5004534?v=4)](https://github.com/alexweissman "alexweissman (1 commits)")

---

Tags

userfrostinguserfrosting-componentcacheuserfrosting

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.7M64](/packages/spatie-laravel-responsecache)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9742.3M121](/packages/roots-acorn)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k55.1k1](/packages/mike-bronner-laravel-model-caching)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k14.1M122](/packages/laravel-pulse)[unisharp/laravel-filemanager

A file upload/editor intended for use with Laravel 5 to 10 and CKEditor / TinyMCE

2.1k3.4M81](/packages/unisharp-laravel-filemanager)

PHPackages © 2026

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