public Task <IList <Country> > GetAll() { IList <Country> res = _cache.Get("contries") as IList <Country>; if (res != null) { return(Task.FromResult(res)); } else { var cnt = Task.Run(() => _repository.GetAll().Result); _cache.Add("contries", cnt.Result); return(cnt); } }
// GET api/country public IHttpActionResult Get() { IList <Language> res = _cache.Get("languages") as IList <Language>; if (res != null) { return(Ok(Task.FromResult(res))); } else { var cnt = Task.Run(() => _service.GetAll().Result); _cache.Add("languages", cnt.Result); return(Ok(cnt)); } }