public ActionResult <string> Get(string source, string destination, DateTime date) { var key = source + destination + date.Date.ToShortDateString(); var cacheResult = _redisDB.StringGet(key); if (!cacheResult.HasValue) { var result = _flightsRepository.GetFlightByDate(source, destination, date); if (result == null) { return(NotFound()); } _redisDB.StringSet(key, JsonConvert.SerializeObject(result)); return(Ok(result)); } Request.HttpContext.Response.Headers.Add("X-Cache", "true"); return(Ok(cacheResult.ToString())); }
public ActionResult <string> Get(string source, string destination, DateTime date) { var result = _flightsRepository.GetFlightByDate(source, destination, date); return(Ok(result)); }