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

ActiveLibrary[Caching](/categories/caching)

masnun/cache
============

A package that allows you to use two caching engines, one as a fallback for the other

18PHP

Since Oct 12Pushed 11y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Cache
-----

[](#cache)

A laravel package that allows using two caching engines, one as a fallback for the other

### Installation

[](#installation)

Add the following to your `composer.json` file's `require` section:

```
	"masnun/cache": "dev-master"
```

Run `composer update`. Composer should install the latest version of the package.

Now, register the Service Provider in `app/config/app.php` file. Add the following line to the `providers` array:

```
'Masnun\Cache\CacheServiceProvider'

```

You should next register an `alias` for the API. We recommend `MCache`. Add the following line to the `aliases` array in the same file:

```
'MCache'  => 'Masnun\Cache\CacheFacade',

```

Let's publish the configuration values for the package. Execute from the command line:

```
php artisan config:publish masnun/cache

```

The configuration file will be published to `app/config/packages/masnun/cache/cache.php`. Please feel free to tweak the values. Here's a short description:

- `primary` - the name of the primary cache driver (eg. 'memcached' for memcached )
- `secondary` - the name of the fallback cache driver
- `default_expiration` - the default value for cache expiration
- `async` - should the data be offloaded using background async queues?
- `async_driver` - if yes, then using which queue driver?

(PS: The async data offloading still not implemented, it's work in progress).

### Code Sample

[](#code-sample)

```
Route::get('/', function ()
{
    MCache::put('name', 'masnun', 60);
    return MCache::get('name');
});
```

Please feel free to be creative and try the usual `Cache` APIs. Here's a list of currently implemented methods:

- put()
- add()
- has()
- get()
- forever()
- remember()
- rememberForever()
- pull()
- forget()

###  Health Score

20

—

LowBetter than 12% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/191543?v=4)[Abu Ashraf Masnun](/maintainers/masnun)[@masnun](https://github.com/masnun)

---

Top Contributors

[![masnun](https://avatars.githubusercontent.com/u/191543?v=4)](https://github.com/masnun "masnun (2 commits)")

### Embed Badge

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

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

###  Alternatives

[iazaran/smart-cache

Smart Cache is a caching optimization package designed to enhance the way your Laravel application handles data caching. It intelligently manages large data sets by compressing, chunking, or applying other optimization strategies to keep your application performant and efficient.

21114.2k](/packages/iazaran-smart-cache)[phpfastcache/phpssdb

PHP SSDB Driver for phpFastCache

14736.9k1](/packages/phpfastcache-phpssdb)[rapidwebltd/rw-file-cache

RW File Cache is a PHP File-based Caching Library. Its syntax is designed to closely resemble the PHP memcache extension.

15196.8k7](/packages/rapidwebltd-rw-file-cache)[yuzuru-s/redis-recommend

Wrapping Redis's sorted set APIs for specializing recommending operations.

392.9k](/packages/yuzuru-s-redis-recommend)[ichhabrecht/intcache

Turn uncachable page objects into cacheable links

193.9k](/packages/ichhabrecht-intcache)

PHPackages © 2026

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