PHPackages                             dv0vd/laravel-redis-stale-refs-cleaner - 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. [CLI &amp; Console](/categories/cli)
4. /
5. dv0vd/laravel-redis-stale-refs-cleaner

ActiveLibrary[CLI &amp; Console](/categories/cli)

dv0vd/laravel-redis-stale-refs-cleaner
======================================

Laravel console command to purge stale Redis cache references

1.0.0(8mo ago)01MITPHPPHP &gt;=7.4

Since Nov 27Pushed 6mo agoCompare

[ Source](https://github.com/dv0vd/laravel-redis-stale-refs-cleaner)[ Packagist](https://packagist.org/packages/dv0vd/laravel-redis-stale-refs-cleaner)[ Docs](https://github.com/dv0vd/laravel-redis-stale-refs-cleaner)[ RSS](/packages/dv0vd-laravel-redis-stale-refs-cleaner/feed)WikiDiscussions main Synced 1w ago

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

Laravel Redis Stale References Cleaner
======================================

[](#laravel-redis-stale-references-cleaner)

A lightweight Laravel console command that helps you keep your Redis cache clean and efficient by purging stale (broken) cache references.

In Laravel 6–8, there was no built-in way to safely clean up Redis sets containing references to keys that no longer exist. Laravel 9 introduced a helper command (`php artisan cache:prune-stale-tags`), but older versions require a custom solution — this package fills that gap.

Why This Package Exists
-----------------------

[](#why-this-package-exists)

When using Redis to store reference sets (e.g., `standard_ref` for temporary caches or `forever_ref` for permanent caches), over time some referenced keys may expire or be deleted. This can lead to stale references, which in turn can cause:

- Wasted memory in Redis
- Inaccurate cache statistics
- Unexpected behavior when iterating over cache sets

Without a safe cleanup process, these stale references accumulate, slowly “clogging” your cache and potentially affecting application performance.

This command automates the cleanup, safely removing references to keys that no longer exist, keeping your Redis cache tidy and efficient.

Features
--------

[](#features)

- Safe purging of stale cache references from Redis sets
- Works with both phpredis (`ext-redis`) and `predis/predis` clients
- Fully compatible with **Laravel 6+**
- Chunked processing for large sets to avoid memory issues
- Logs progress and provides a summary of purged keys
- Easy to run via Artisan console

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

[](#installation)

```
composer require dv0vd/laravel-redis-stale-refs-cleaner
```

Usage
-----

[](#usage)

1. Run the command:

```
php artisan redis:purge-stale-refs
```

2. Sit back, relax, and enjoy your clean Redis!

###  Health Score

27

—

LowBetter than 46% of packages

Maintenance65

Regular maintenance activity

Popularity1

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

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

265d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/100205424?v=4)[Viacheslav Davydov](/maintainers/dv0vd)[@dv0vd](https://github.com/dv0vd)

---

Tags

phpconsolelaravelartisanlaravel-packagerediscachecommandpurgecleanupreferencesstalerefscache-clean

### Embed Badge

![Health badge](/badges/dv0vd-laravel-redis-stale-refs-cleaner/health.svg)

```
[![Health](https://phpackages.com/badges/dv0vd-laravel-redis-stale-refs-cleaner/health.svg)](https://phpackages.com/packages/dv0vd-laravel-redis-stale-refs-cleaner)
```

###  Alternatives

[propaganistas/laravel-disposable-email

Disposable email validator

6023.2M7](/packages/propaganistas-laravel-disposable-email)[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

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

Automatic caching for Eloquent models.

2.4k161.4k2](/packages/mike-bronner-laravel-model-caching)[laravel/ai

The official AI SDK for Laravel.

1.1k4.6M323](/packages/laravel-ai)[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)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

265.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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