Remove cache with tags by cache key

Viewed 698

The documentation says

You may flush all items that are assigned a tag or list of tags. For example, this statement would remove all caches tagged with either people, authors, or both. So, both Anne and John would be removed from the cache:

Cache::tags(['people', 'authors'])->flush();

In contrast, this statement would remove only cached values tagged with authors, so Anne would be removed, but not John:

Cache::tags('authors')->flush();

But doesn't talk about if you wanted to flush specifically John or Anne

Is there still a way to remove by key?

Because Cache::forget('John'); does not work in this case.

Something like Cache::tags(['authors'])->flush('John'); perhaps.

Or is the only practical way to make a unique tag which would just be the same as the key?

0 Answers
Related