Query caching for Laravel.
Rememberable is an Eloquent trait for Laravel that adds remember() query methods. This makes it super easy to cache your query results for an adjustable amount of time.
// Get a the first user's posts and remember them for a day.
User::first()->remember(now()->addDay())->posts()->get();
// You can also pass the number of seconds if you like (before Laravel 5.8 this will be interpreted as minutes).
User::first()->remember(60 * 60 * 24)->posts()->get();
It works by simply remembering the SQL query that was used and storing the result. If the same query is attempted while the cache is persisted it will be retrieved from the store instead of hitting your database again.