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)28.1k↓85.7%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 3d 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

32

—

LowBetter than 69% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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

1213d ago

PHP version history (2 changes)1.0.0PHP ^7.4

1.0.1PHP ^7.4|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5871190?v=4)[Adam Privette](/maintainers/aprivette)[@aprivette](https://github.com/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

[laravel/sail

Docker files for running a basic Laravel application.

1.9k205.7M1.3k](/packages/laravel-sail)[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k9.0M69](/packages/spatie-laravel-responsecache)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k91.9k1](/packages/mike-bronner-laravel-model-caching)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M200](/packages/laravel-ai)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M151](/packages/laravel-mcp)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

725173.2k14](/packages/tallstackui-tallstackui)

PHPackages © 2026

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