private static WhoisRecord Whois(string ipAddress) { ipAddress = ipAddress.Scrub(); if (string.IsNullOrEmpty(ipAddress)) { ipAddress = GetIpAddressFromRequest(ipAddress); } Assert.ValidInput(ipAddress, "ipAddress"); if (ServiceCache.IsInCache <WhoisRecord>(ipAddress)) { var cachedRecord = (WhoisRecord)ServiceCache.GetFromCache <WhoisRecord>(ipAddress); if (cachedRecord != null) { return(cachedRecord); } } var whoisClient = new WhoisClient(ipAddress); var record = whoisClient.GetWhoisRecord(); HandleErrors(whoisClient.Errors); return(record.AddToCache(ipAddress)); }
private static WhoisRecord Whois(string ipAddress) { ipAddress = ipAddress.Scrub(); if (string.IsNullOrEmpty(ipAddress)) { ipAddress = GetIpAddressFromRequest(ipAddress); } Assert.ValidInput(ipAddress, "ipAddress"); if (ServiceCache.IsInCache<WhoisRecord>(ipAddress)) { var cachedRecord = (WhoisRecord) ServiceCache.GetFromCache<WhoisRecord>(ipAddress); if (cachedRecord != null) { return cachedRecord; } } var whoisClient = new WhoisClient(ipAddress); var record = whoisClient.GetWhoisRecord(); HandleErrors(whoisClient.Errors); return record.AddToCache(ipAddress); }