{"id":22439668,"url":"https://github.com/byerikas/cache-tags","last_synced_at":"2026-04-02T14:46:50.796Z","repository":{"id":263608065,"uuid":"890929134","full_name":"byErikas/cache-tags","owner":"byErikas","description":"Allows for Redis/Valkey cache flushing multiple tagged items by a single tag.","archived":false,"fork":false,"pushed_at":"2026-03-18T09:16:17.000Z","size":167,"stargazers_count":14,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"v3.x.x","last_synced_at":"2026-03-19T00:50:51.361Z","etag":null,"topics":["cache","laravel","redis","tags","valkey"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/byerikas/cache-tags","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/byErikas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-11-19T12:35:24.000Z","updated_at":"2026-03-16T12:22:50.000Z","dependencies_parsed_at":"2025-02-26T07:18:17.212Z","dependency_job_id":"ddfec766-5137-4a60-9ebe-c2f22feb88d4","html_url":"https://github.com/byErikas/cache-tags","commit_stats":null,"previous_names":["byerikas/symfony-cache","byerikas/valkey-taggable-cache","byerikas/classic-taggable-cache","byerikas/cache-tags"],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/byErikas/cache-tags","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byErikas%2Fcache-tags","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byErikas%2Fcache-tags/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byErikas%2Fcache-tags/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byErikas%2Fcache-tags/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/byErikas","download_url":"https://codeload.github.com/byErikas/cache-tags/tar.gz/refs/heads/v3.x.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byErikas%2Fcache-tags/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31308406,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T12:59:32.332Z","status":"ssl_error","status_checked_at":"2026-04-02T12:54:48.875Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cache","laravel","redis","tags","valkey"],"created_at":"2024-12-06T01:15:37.603Z","updated_at":"2026-04-02T14:46:50.782Z","avatar_url":"https://github.com/byErikas.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eLaravel Redis/Valkey Cache Tags\u003c/h1\u003e\r\n\r\n\u003cp align=\"center\"\u003e\r\n  \u003ca href=\"https://github.com/byErikas/cache-tags/actions\"\u003e\u003cimg src=\"https://github.com/byErikas/cache-tags/actions/workflows/tests.yml/badge.svg\" alt=\"tests Status\"\u003e\u003c/a\u003e\r\n  \u003ca href=\"https://codecov.io/gh/byErikas/cache-tags\"\u003e\u003cimg src=\"https://codecov.io/gh/byErikas/cache-tags/graph/badge.svg?token=Y7F8CZFISH\"/\u003e\u003c/a\u003e\r\n  \u003ca href=\"https://packagist.org/packages/byerikas/cache-tags\"\u003e\u003cimg src=\"https://img.shields.io/packagist/v/byerikas/cache-tags\" alt=\"Packagist Version\"\u003e\u003c/a\u003e\r\n  \u003ca href=\"https://github.com/byErikas/cache-tags/blob/v3.x.x/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/byerikas/cache-tags\" alt=\"GitHub License\"\u003e\u003c/a\u003e\r\n\u003c/p\u003e\r\n\r\nAllows for Redis/Valkey cache flushing multiple tagged items by a single tag. \r\nThis is done by adding a new store driver, `redis-tags`, that adds a different functionality.\r\nLaravel 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.:\r\n```php\r\nCache::tags([\"tag1\", \"tag2\"])-\u003eput(\"key\", true);\r\nCache::tags([\"tag1\"])-\u003eget(\"key\"); //Will result in the default value (null)\r\nCache::tags([\"tag1\", \"tag2\"])-\u003eget(\"key\"); //Will result in true\r\nCache::tags([\"tag2\", \"tag1\"])-\u003eget(\"key\"); //Will result in the default value (null)\r\n```\r\nThis 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:\r\n```php\r\nCache::tags([\"tag1\", \"tag2\"])-\u003eput(\"key\", true);\r\nCache::tags([\"tag1\"])-\u003eget(\"key\"); //Will result in true\r\nCache::tags([\"tag2\", \"tag1\"])-\u003eget(\"key\"); //Will result in true\r\nCache::get(\"key\"); //Will result in true\r\n```\r\nUsing `Cache::forever()` will now store items for 100 days, not forever, to allow the values to be memory managed, instead of tags.\r\nFlushing 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))\r\n```php\r\nCache::tags([\"tag1\", \"tag2\"])-\u003eput(\"key\", true);\r\nCache::tags([\"tag1\"])-\u003eflush(); //Will flush \"key\"\r\nCache::flush(); //Will flush \"key\"\r\n```\r\n\r\n# Limitations\r\nDifferent 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.:\r\n```php\r\nCache::tags([\"tag1\", \"tag2\"])-\u003eput(\"key\", \"value1\");\r\n/** This overwrites the key above since there is a shared tag. */\r\nCache::tags([\"tag2\"])-\u003eput(\"key\", \"value2\");\r\nCache::tags([\"tag1\"])-\u003eget(\"key\"); //Will result in \"value2\"\r\nCache::get(\"key\"); //Will result in \"value2\"\r\n```\r\n\r\n# Installation\r\nPlease read the [Limitations](#limitations) section before use as this can have breaking changes.\r\nThe package can be installed using:\r\n```\r\ncomposer require byerikas/cache-tags\r\n```\r\nTo 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`.\r\nIt'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.\r\n\r\n\r\nTo prevent any memory issues use Redis/Valkey `maxmemory-policy` of `volatile-*`.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbyerikas%2Fcache-tags","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbyerikas%2Fcache-tags","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbyerikas%2Fcache-tags/lists"}