Exemplo n.º 1
0
 public UrlResolver GetUrlResolver(HolidayConfigurationSnapshot configSnapshot)
 {
     ConfigurationCache.CacheEntry endpointCacheEntry = this.GetEndpointCacheEntry(configSnapshot);
     if (endpointCacheEntry.UrlResolver == null)
     {
         throw endpointCacheEntry.ErrorInformation;
     }
     return(endpointCacheEntry.UrlResolver);
 }
Exemplo n.º 2
0
        private ConfigurationCache.CacheEntry GetEndpointCacheEntry(HolidayConfigurationSnapshot configSnapshot)
        {
            Uri calendarEndpoint          = configSnapshot.CalendarEndpoint;
            int configurationFetchTimeout = configSnapshot.ConfigurationFetchTimeout;

            ConfigurationCache.CacheEntry cacheEntry;
            lock (this.cache)
            {
                if (!this.cache.TryGetValue(calendarEndpoint.AbsoluteUri, out cacheEntry) || (cacheEntry.EndpointInformation == null && cacheEntry.UtcTimeStamp.AddMinutes(5.0) < this.dateTimeFactory.GetUtcNow()))
                {
                    cacheEntry = this.RequestEndpointInfo(calendarEndpoint, configurationFetchTimeout);
                }
            }
            return(cacheEntry);
        }