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

ActiveLibrary[Caching](/categories/caching)

maherio/graceful-cache
======================

A wrapper for Laravel's Cache Repository to allow for graceful caching.

1.0.0(11y ago)65.1kMITPHPPHP &gt;=5.3.0

Since Oct 27Pushed 11y agoCompare

[ Source](https://github.com/maherio/graceful-cache)[ Packagist](https://packagist.org/packages/maherio/graceful-cache)[ Docs](http://github.com/maherio/graceful-cache)[ RSS](/packages/maherio-graceful-cache/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

Graceful Cache for Laravel 4
============================

[](#graceful-cache-for-laravel-4)

#### A way to further optimize your caching layer

[](#a-way-to-further-optimize-your-caching-layer)

This package is a simple way to optimize performance by never allowing a flood of requests to hit the database (or other data source).

##### The problem Graceful Caching is trying to solve:

[](#the-problem-graceful-caching-is-trying-to-solve)

When a cache value expires, requests go directly to the data store. However, if this cache clear happens during a traffic spike, many more requests will fall through than you might like. The effects of this can vary from slightly slower response times, to violating an API's rate limiting, to actually crashing your database.

##### The solution:

[](#the-solution)

Instead of allowing all requests to fallback to the database, we will detect when a cache value is about to expire and instead extend it's life for subsequent requests while fetching the updated value from the source.

##### Example workflow:

[](#example-workflow)

- No cached value. Request 1 comes in, we fetch the result from the database, save the value to the cache, and return the results.
- Cached value from Request 1. N-1 requests come in and receive the cached value immediately.
- Cached value from Request 1. Request N comes in and sees the cached value is about to expire, and so we write back that cached value with an extended expiration time. After that, we talk to the database and get the updated value behind the scenes.
- Cached value from Request 1, extended by Request N. While request N is talking to the database, all other requests still see the cached value.
- Cached value from Request 1, extended by Request N. Request N gets a value back from the database, and so updates the cache.
- Cached value from Request N.

As you can see, there is always a valid cached value. Thus, many fewer requests actually hit the database (or api or any other layer you want hidden behind the cache).

### Required setup

[](#required-setup)

In the `require` key of `composer.json` file add the following

```
"maherio/graceful-cache": "1.0.*"

```

Run the Composer update comand

```
$ composer update

```

In your `config/app.php` add `'GracefulCache\ServiceProvider'` to the end of the `$providers` array

```
'providers' => array(

    'Illuminate\Foundation\Providers\ArtisanServiceProvider',
    'Illuminate\Auth\AuthServiceProvider',
    ...
    'GracefulCache\ServiceProvider',

),
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4220d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/32254e74d5f1717310fb9b6d597f236cdd864fe82daebd6f7ef31735695251b5?d=identicon)[maherio](/maintainers/maherio)

---

Top Contributors

[![maherio](https://avatars.githubusercontent.com/u/6331710?v=4)](https://github.com/maherio "maherio (10 commits)")

---

Tags

laravelcachecaching

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.2M51](/packages/spatie-laravel-responsecache)[maartenstaa/laravel-41-route-caching

This package allows you to cache your routes definitions, thereby speeding up each request.

25371.9k](/packages/maartenstaa-laravel-41-route-caching)[swiggles/memcache

Memcache driver for Laravel 5

1449.9k1](/packages/swiggles-memcache)[omaralalwi/lexi-translate

Laravel translation package with morph relationships and caching.

754.3k2](/packages/omaralalwi-lexi-translate)[matthewbdaly/laravel-repositories

A base repository class and interface, together with a caching decorator. Extend them for use in your own projects.

121.2k3](/packages/matthewbdaly-laravel-repositories)

PHPackages © 2026

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