Summer sale! Save 50% on access to our entire library of courses.Join here →

Clear Laravel Cache Keys with Artisan

June 14th, 2024

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
Thanks for reading! If you found this article helpful, you might enjoy our practical screencasts too.
Author
Alex Garrett-Smith
Share :

Comments

No comments, yet. Be the first to leave a comment.

Tagged under