[X.x] Add support for cache tags
Please check these requirements
- [X] This feature helps everyone using this package
- [X] It's feasible and maintainable
- [X] It's non breaking
- [X] I issued a PR with the implementation (optional)
Description
Would it be possible to add support for optionally using cache tags? So we can do things like:
Article::latest('published_at')->with('drafts')->take(5)->cache(key: 'latest_articles' tag: 'tenant_1')->get();
Cache::tags('tenant_1')->flush();
etc.
Code sample
See above :)
I think it's feasible, as long the cache stores is compatible with tags.
Okay, I think I have some kind of implementation, but it will be with a giant warning because the store must be taggable, and the default cache is file which isn't.
Also, Laravel already discourages using tagging values.
Awesome! Look forward to testing it,
No longer in the works, as Laravel doesn't document it probably to discourage it.
You can still use the Cache directly to retrieve your database results.