PHPackages                             aprivette/laravel-cache-refs - 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. aprivette/laravel-cache-refs

ActiveLibrary[Caching](/categories/caching)

aprivette/laravel-cache-refs
============================

A Laravel Artisan command to purge cache tag refs from Redis

1.0.1(3y ago)27.8k↓50%MITPHPPHP ^7.4|^8.0

Since Aug 9Pushed 1y ago1 watchersCompare

[ Source](https://github.com/aprivette/laravel-cache-refs)[ Packagist](https://packagist.org/packages/aprivette/laravel-cache-refs)[ Docs](https://github.com/aprivette/laravel-cache-refs)[ RSS](/packages/aprivette-laravel-cache-refs/feed)WikiDiscussions main Synced 1mo ago

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

Laravel Cache Refs
==================

[](#laravel-cache-refs)

*A Laravel Artisan command to purge cache tag refs from Redis.*

Problem
-------

[](#problem)

Have you noticed massive Redis sets which have the key suffix `standard_ref` or `forever_ref` clogging up your cache database?

**If you use [Laravel's cache tag feature](https://laravel.com/docs/9.x/cache#cache-tags) and are unable to routinely wipe your entire cache, you will inevitably accumulate junk in your Redis database.** To make this feature work, Laravel creates Redis sets for each tag with members pointing to each key assigned to that tag.

For example, let's say you have a cache key "dog" with the tag "animal". If the "dog" Redis key expires, that key's set member remains for the "animal" tag.

Solution
--------

[](#solution)

**This command is designed to be run on a schedule job for applications experiencing this issue.** It loops through all cache refs and ensures the ref set members point to existing keys. It will remove any set members that point to non existant target keys.

Usage
-----

[](#usage)

Install:

`composer require aprivette/laravel-cache-refs`

After installing, you can run the command like so:

`php artisan refs:purge`

This command defaults to the `cache` connection. If you have another cache connection, you may specify it.

`php artisan refs:purge custom_redis_connection`

Caveats
-------

[](#caveats)

This package only works with Redis stores.

Future Improvements
-------------------

[](#future-improvements)

The key queries should probably be replaced with scans for memory conservation with larger Redis stores. I haven't run into this issue yet though.

###  Health Score

33

—

LowBetter than 74% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

Every ~212 days

Total

2

Last Release

1157d ago

PHP version history (2 changes)1.0.0PHP ^7.4

1.0.1PHP ^7.4|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/47f1795cd5f01e680291566e5ea91ff26602ec1f9973b94faed9725f924bc2bf?d=identicon)[aprivette](/maintainers/aprivette)

---

Top Contributors

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

---

Tags

aprivettelaravel-cache-refs

### Embed Badge

![Health badge](/badges/aprivette-laravel-cache-refs/health.svg)

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

###  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)[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[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.

2057.2k](/packages/iazaran-smart-cache)[nexxai/laravel-cfcache

A handful of Cloudflare cache helpers for Laravel

1317.7k](/packages/nexxai-laravel-cfcache)

PHPackages © 2026

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