PHPackages                             khairul/laravel-auto-refresh-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. khairul/laravel-auto-refresh-cache

ActiveLibrary[Caching](/categories/caching)

khairul/laravel-auto-refresh-cache
==================================

Automatically refresh Laravel cache on model save or delete events.

1(9mo ago)351MITPHPPHP &gt;=8.0

Since Aug 12Pushed 9mo agoCompare

[ Source](https://github.com/mdkhairul773islam/laravel-auto-refresh-cache)[ Packagist](https://packagist.org/packages/khairul/laravel-auto-refresh-cache)[ RSS](/packages/khairul-laravel-auto-refresh-cache/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Laravel Auto Refresh Cache Package
==================================

[](#laravel-auto-refresh-cache-package)

This package provides an easy way to auto-refresh cache for Laravel models on save/delete actions.

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

[](#installation)

```
composer require khairul/laravel-auto-refresh-cache:dev-main
```

Open config/app.php and add the following line to the providers array:

```
'providers' => [
    // Other service providers...

    Khairul\AutoRefreshCache\AutoRefreshCacheServiceProvider::class,
],
```

Publish Config
--------------

[](#publish-config)

```
php artisan vendor:publish --tag=config --provider="Khairul\AutoRefreshCache\AutoRefreshCacheServiceProvider"
```

Configuration
-------------

[](#configuration)

Add your cache-aware models to `config/auto_refresh_cache.php`:

```
return [
    'models' => [
        App\Models\CancelReason::class,
        App\Models\ProductCategory::class,
    ],
];
```

Usage
-----

[](#usage)

In your model, use the trait and set the cache key:

```
use Khairul\AutoRefreshCache\Traits\AutoRefreshCache;

class CancelReason extends Model
{
    use AutoRefreshCache;

    protected static string $cacheKey = 'cancel_reasons_all';
}
```

Fetch cached data:

```
$cancelReasons = CancelReason::allFromCache();
```

Refresh Cache Manually
----------------------

[](#refresh-cache-manually)

Run this artisan command to refresh all caches:

```
php artisan cache:refresh
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance58

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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

273d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/18d5131bfa05473a09ddde5223e538eaff129c30627e449ee0c17f0295a95052?d=identicon)[mdkhairul773islam](/maintainers/mdkhairul773islam)

---

Top Contributors

[![mdkhairul773islam](https://avatars.githubusercontent.com/u/22705639?v=4)](https://github.com/mdkhairul773islam "mdkhairul773islam (6 commits)")

### Embed Badge

![Health badge](/badges/khairul-laravel-auto-refresh-cache/health.svg)

```
[![Health](https://phpackages.com/badges/khairul-laravel-auto-refresh-cache/health.svg)](https://phpackages.com/packages/khairul-laravel-auto-refresh-cache)
```

###  Alternatives

[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.2M51](/packages/spatie-laravel-responsecache)[genealabs/laravel-model-caching

Automatic caching for Eloquent models.

2.4k4.8M26](/packages/genealabs-laravel-model-caching)[mikebronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k127.1k1](/packages/mikebronner-laravel-model-caching)[illuminate/cache

The Illuminate Cache package.

12835.6M1.4k](/packages/illuminate-cache)[laragear/cache-query

Remember your query results using only one method. Yes, only one.

272122.8k](/packages/laragear-cache-query)[namoshek/laravel-redis-sentinel

An extension of Laravels Redis driver which supports connecting to a Redis master through Redis Sentinel.

38679.0k](/packages/namoshek-laravel-redis-sentinel)

PHPackages © 2026

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