I am trying to cache database query as given below (Laravel 5.7):
Cache::remember('footer_pages', 180, function () {
DB::table('pages')->select('id', 'title')->where(array('status' => 'Published', 'menu_position' => 'Footer'))->orderBy('sort', 'ASC')->get();
});
But Cache is empty. Please help me find what mistake I did.
return DB::table.... The functionrememberwill cache the result of the callback