public LocationsResponse GetLocations(string city = "") { var cacheProvider = new MemCacheProvider <LocationsResponse>(); string cacheKey = $"city;{city}"; var response = cacheProvider.TryGetResponse(cacheKey); if (response == null) { var service = new SearchService(); response = service.FindByCity(city); cacheProvider.SaveResponse(cacheKey, response); } return(response); }
public IPResponse GetLocation(string ip = "") { var cacheProvider = new MemCacheProvider <IPResponse>(); string cacheKey = $"ip;{ip}"; var response = cacheProvider.TryGetResponse(cacheKey); if (response == null) { var service = new SearchService(); response = service.FindByIp(ip); cacheProvider.SaveResponse(cacheKey, response); } return(response); }