public CurrencyFetchingService(
     ICurrencyCachingService currencyCachingService,
     ICurrencyParsingService currencyParsingService,
     ILogger <CurrencyFetchingService> logger,
     IOptions <UrlsConfig> urlsConfig,
     IOptions <CacheKeyConfig> cacheKeyConfig)
 {
     _currencyCachingService = currencyCachingService;
     _currencyParsingService = currencyParsingService;
     _logger         = logger;
     _urlsConfig     = urlsConfig.Value;
     _cacheKeyConfig = cacheKeyConfig.Value;
 }
Пример #2
0
        public string GetCacheKey(int keyType, string key)
        {
            var cacheKey = "";

            switch (keyType)
            {
            case (int)CacheKeyType.IM:
                cacheKey = CacheKeyConfig.GetIMGroupKey(key); break;

            case (int)CacheKeyType.ThumbsUp:
                cacheKey = CacheKeyConfig.GetThumbsUpKey(key); break;

            case (int)CacheKeyType.Seckill:
                cacheKey = CacheKeyConfig.GetSeckillStockKey(key); break;

            case (int)CacheKeyType.SeckillWithHold:
                cacheKey = CacheKeyConfig.GetSeckillWithHoldKey(key); break;

            case (int)CacheKeyType.SkuLockQuantity:
                cacheKey = CacheKeyConfig.GetSkuLockQuantityKey(key); break;

            case (int)CacheKeyType.NoticeSpu:
                cacheKey = CacheKeyConfig.GetNoticeSpuKey(key); break;

            case (int)CacheKeyType.StorePaymentFlow:
                cacheKey = CacheKeyConfig.GetStorePaymentFlowKey(key); break;

            case (int)CacheKeyType.BsGenTokenKey:
                cacheKey = CacheKeyConfig.GetBsGenTokenKey(key); break;

            case (int)CacheKeyType.BsTokenKey:
                cacheKey = CacheKeyConfig.GetBsTokenKey(key); break;

            case (int)CacheKeyType.SVThumbsUp:
                cacheKey = CacheKeyConfig.GetShortVideoThunbsUpKey(key); break;

            case (int)CacheKeyType.SVPlayCount:
                cacheKey = CacheKeyConfig.GetShortVideoPlayCountKey(key); break;

            case (int)CacheKeyType.SVCThumbsUp:
                cacheKey = CacheKeyConfig.GetShortVideoCommentThumbsUp(key); break;

            case (int)CacheKeyType.SVCCount:
                cacheKey = CacheKeyConfig.GetShortVideoCommentCount(key); break;

            default:
                break;
            }

            return(cacheKey);
        }
Пример #3
0
            public AuthenticationRequestHandler(string apiKey, string clientId, string clientSecret, string scopes)
            {
                InnerHandler = new HttpClientHandler();

                if (string.IsNullOrWhiteSpace(clientId))
                {
                    throw new ArgumentException("ClientId must be specified. This should be set to the OAuth 2.0 client ID of the calling application.", "clientId");
                }
                if (string.IsNullOrWhiteSpace(clientSecret))
                {
                    throw new ArgumentException("Client Secret must be specified. This should be set to the OAuth 2.0 client secret of the calling application.", "clientSecret");
                }
                if (scopes == null || scopes.Length == 0)
                {
                    throw new ArgumentException("One or more scopes must be specified.", "scopes");
                }

                Scopes       = scopes;
                ApiKey       = apiKey;
                ClientId     = clientId;
                ClientSecret = clientSecret;
                CacheKeys    = new CacheKeyConfig(ClientId, Scopes);
            }