public async Task <IActionResult> GetFoods() { var foods = _cache.Get <IEnumerable <FoodDto> >("foods"); if (foods == null) { Console.WriteLine("Fetching from service"); foods = await _foodService.BrowseAsync(null); _cache.Set("foods", foods, TimeSpan.FromMinutes(1)); } else { Console.WriteLine("Fetching from cache"); } return(Json(foods)); }