public GeolocalizationResult PerformGeolocalization(GeolocalizationCommand command) { var http = new HttpClient { Request = { Accept = HttpContentTypes.ApplicationJson } }; var builtUrl = string.Format(ServiceUrl, command); var response = http.Get(builtUrl); var parser = new GoogleMapsGeolocalizationServiceParser(); return parser.ParseJsonText(response.RawText); }
public GeolocalizationResult PerformGeolocalization(GeolocalizationCommand command) { if (_poorManCache.ContainsKey(command)) { CacheHits++; return _poorManCache[command]; } var result = _service.PerformGeolocalization(command); System.Threading.Thread.Sleep(TimeAfterQuery); if (result.HasSomething) { CacheMiss++; _poorManCache.Add(command, result); return result; } throw new Exception("Invalid geolocalization"); }