You can pass a closure when retrieving a cache item to call if it does not exist.
6 Remaining$value = Cache::get('key', function () {
return DB::table(...)->get();
});
Tip: Incomplete tests older than 2 days will be deleted. Completed tests are available forever.
Permalink: https://rappasoft.com/quizzes/laravel/cache/acd9ab29-58df-4a04-b520-585b404c49f4
Find this useful? Consider sponsoring me on GitHub
You can also get here with laravel-quizzes.com