Inheritance: IDisposable
Ejemplo n.º 1
0
        public HaloSession(Product product)
        {
            if (product.RateLimit != null)
            {
                _rateGate = new RateGate(product.RateLimit);
            }

            var handler = new HttpClientHandler
            {
                AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
            };

            _httpClient = new HttpClient(handler);
            _httpClient.DefaultRequestHeaders.Add(HeaderName, product.SubscriptionKey);
        }
Ejemplo n.º 2
0
        public HaloSession(IProduct product, IHaloSharpTimer timer, ICacheSettings cacheSettings = null, IObjectCache cache = null)
        {
            Cache.MetadataCacheDuration = cacheSettings?.MetadataCacheDuration;
            Cache.ProfileCacheDuration  = cacheSettings?.ProfileCacheDuration;
            Cache.StatsCacheDuration    = cacheSettings?.StatsCacheDuration;
            Cache.ObjectCache           = cache;

            if (product.RateLimit != null)
            {
                _rateGate = new RateGate(product.RateLimit, timer);
            }

            var handler = new HttpClientHandler
            {
                AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
            };

            _httpClient = new HttpClient(handler);
            _httpClient.DefaultRequestHeaders.Add(HeaderName, product.SubscriptionKey);
        }