Laravel Pro Tips
Just found out there's a single artisan command to clear out all Laravel caches, much less typing!
When caching query results in Laravel, you can do this little trick to flush the cache when you're creating or updating a model ✨
🔥 #Laravel Tip: Expensive queries (that return values which don’t change very often) are prime candidates for caching. Make use of the ‘remember’ method for this purpose:
🌶️ #Laravel tip: Laravel caching comes in handy especially when you are serving some static pages or static data. For instance, serving a list of countries, that rarely changes!
Bilal Haidar - Available 4 Laravel gigs
🔥 #Laravel Tip: I often find myself maintaining counters in the cache. Laravel makes this easy to do with ‘increment’ and ‘decrement’ methods. Perfect for when you don’t need to keep the values around in the database.
Handling HTTP caching is a little tricky in #Laravel because it's can be a two-step process (eg. on pages that need to make lots of external API/database calls).
Here's a basic example. I've got another package in the works that will make it much easier! https://t.co/tuuwtNH3IL
🔥 #Laravel Tip: Got lots of cached items that belong to a resource e.g. a user? Deleting them all can be pain, but not if you group them using a tag. All you need to do then, is simply delete the tag.
Aug 20th, 2020
Using simple yet effective caching for Laravel queries
The simple caching strategy in Laravel can greatly improve the loading speed of your site.