PHPackages                             byerikas/cache-tags - 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. byerikas/cache-tags

ActiveLibrary[Caching](/categories/caching)

byerikas/cache-tags
===================

Allows for Redis/Valkey cache flushing multiple tagged items by a single tag.

3.0.1(1w ago)1420.4k↓31.2%4MITPHP

Since Mar 18Pushed 1w ago1 watchersCompare

[ Source](https://github.com/byErikas/cache-tags)[ Packagist](https://packagist.org/packages/byerikas/cache-tags)[ RSS](/packages/byerikas-cache-tags/feed)WikiDiscussions v3.x.x Synced 2d ago

READMEChangelog (10)Dependencies (9)Versions (26)Used By (0)

Laravel Redis/Valkey Cache Tags
===============================

[](#laravel-redisvalkey-cache-tags)

 [![tests Status](https://github.com/byErikas/cache-tags/actions/workflows/tests.yml/badge.svg)](https://github.com/byErikas/cache-tags/actions) [![](https://camo.githubusercontent.com/db9044a31a1068af09714833a8c63fe673db2e8da9c3d5b4b8584312cfb60ace/68747470733a2f2f636f6465636f762e696f2f67682f62794572696b61732f63616368652d746167732f67726170682f62616467652e7376673f746f6b656e3d59374638435a46495348)](https://codecov.io/gh/byErikas/cache-tags) [![Packagist Version](https://camo.githubusercontent.com/29afad65165333cd6908cccabe5b55ef1f7771e71510db0b59dd60767dc3a650/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f62796572696b61732f63616368652d74616773)](https://packagist.org/packages/byerikas/cache-tags) [![GitHub License](https://camo.githubusercontent.com/7c2b780941fe64ec004d2f3d2f1921cbb367c04a388d9fbb621116048be8e005/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f62796572696b61732f63616368652d74616773)](https://github.com/byErikas/cache-tags/blob/v3.x.x/LICENSE)

Allows for Redis/Valkey cache flushing multiple tagged items by a single tag. This is done by adding a new store driver, `redis-tags`, that adds a different functionality. Laravel 10+ changed how cache logic works, removing the ability to retrieve an item if not using the exact tags that were present when setting a cache key. E.g.:

```
Cache::tags(["tag1", "tag2"])->put("key", true);
Cache::tags(["tag1"])->get("key"); //Will result in the default value (null)
Cache::tags(["tag1", "tag2"])->get("key"); //Will result in true
Cache::tags(["tag2", "tag1"])->get("key"); //Will result in the default value (null)
```

This changes how that works. Tags no longer have an impact on keys. Tags are used strictly for tagging, and not for creating different key namespaces. E.g:

```
Cache::tags(["tag1", "tag2"])->put("key", true);
Cache::tags(["tag1"])->get("key"); //Will result in true
Cache::tags(["tag2", "tag1"])->get("key"); //Will result in true
Cache::get("key"); //Will result in true
```

Using `Cache::forever()` will now store items for 100 days, not forever, to allow the values to be memory managed, instead of tags. Flushing tags - one is enough to flush the value out of the cache. This leaves some empty references in tag sets but is mitigated by the stale tag pruning command. (see [Installation](#installation))

```
Cache::tags(["tag1", "tag2"])->put("key", true);
Cache::tags(["tag1"])->flush(); //Will flush "key"
Cache::flush(); //Will flush "key"
```

Limitations
===========

[](#limitations)

Different tags DON'T equal different key namespaces. Tagged and non-tagged items use the same key sequence. Ensure keys are unique - tags only tag, not alter keys. E.g.:

```
Cache::tags(["tag1", "tag2"])->put("key", "value1");
/** This overwrites the key above since there is a shared tag. */
Cache::tags(["tag2"])->put("key", "value2");
Cache::tags(["tag1"])->get("key"); //Will result in "value2"
Cache::get("key"); //Will result in "value2"
```

Installation
============

[](#installation)

Please read the [Limitations](#limitations) section before use as this can have breaking changes. The package can be installed using:

```
composer require byerikas/cache-tags

```

To use the new driver - edit your `config/cache.php` and under `stores.YOUR_STORE.driver` set the value to `redis-tags`, and run `php artisan optimize`. It's recommended to have a scheduled command that would prune your stale tags to clean up memory. The command is `php artisan cache:prune-stale-tags`, and should come with Laravel out of the box.

To prevent any memory issues use Redis/Valkey `maxmemory-policy` of `volatile-*`.

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance98

Actively maintained with recent releases

Popularity37

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.3% 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 ~18 days

Recently: every ~0 days

Total

26

Last Release

12d ago

Major Versions

0.0.4 → 2.0.42025-11-13

0.0.5 → 1.0.72026-02-11

1.0.7 → 2.0.52026-02-11

v0.x-dev → 3.0.02026-03-18

v2.x-dev → v3.x-dev2026-06-21

### Community

Maintainers

![](https://www.gravatar.com/avatar/66caa6fdec71c89ea1682dc96f90db0cf2a45adad9f1b34959553f0479290122?d=identicon)[byErikas](/maintainers/byErikas)

---

Top Contributors

[![byErikas](https://avatars.githubusercontent.com/u/55389436?v=4)](https://github.com/byErikas "byErikas (170 commits)")[![Jacobs63](https://avatars.githubusercontent.com/u/16275303?v=4)](https://github.com/Jacobs63 "Jacobs63 (2 commits)")[![webard](https://avatars.githubusercontent.com/u/855788?v=4)](https://github.com/webard "webard (1 commits)")

---

Tags

cachelaravelredistagsvalkeylaravelrediscachetagsvalkey

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/byerikas-cache-tags/health.svg)

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

###  Alternatives

[awssat/laravel-visits

Laravel Redis visits counter for Eloquent models

973172.3k2](/packages/awssat-laravel-visits)[swayok/alternative-laravel-cache

Replacements for Laravel's redis and file cache stores that properly implement tagging idea. Powered by cache pool implementations provided by http://www.php-cache.com/

202583.7k8](/packages/swayok-alternative-laravel-cache)[vink/nova-cache-card

Manage your application's cache from a handy Laravel Nova dashboard card.

26321.4k1](/packages/vink-nova-cache-card)

PHPackages © 2026

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