Avoid this common cache()->remember() mistake in Laravel

I recently spent 2 hours debugging an issue only to realize that my cache()->remember() callback didn't return anything!

To save you from the same frustration, here's a tip: Always return a value in the callback, or it will re-run every time and miss the cache. Trust me, your future self will thank you!

Found this helpful?

If this guide was helpful to you, subscribe to my daily newsletter and give me a follow on X/Twitter. It helps a lot!

Subscribe to Harris Raftopoulos

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe