Clear Laravel Cache Keys with Artisan

June 14th, 2024 • 1 minute read time

To clear a specific cache key in Laravel, use the `cache:forget` command.

So, let's say you have a cache key named home.testimonials. To clear this individual cache key only, you'd issue the following artisan command:

php artisan cache:forget home.testimonials

You can also specify the store you'd like to remove the cache key from. If you were using Redis by default but specifically needed to remove an item from Memcached, you'd specify it like this:

php artisan cache:forget home.testimonials memcached
If you found this article helpful, you'll love our practical screencasts.
Author
Alex Garrett-Smith
Share :

Comments

No comments, yet. Be the first!

Tagged under