/// <summary> /// Used internally only for unit testing. /// </summary> /// <param name="innerHandler">The inner handler to retrieve the content from on cache misses.</param> /// <param name="cacheExpirationPerHttpResponseCode">A mapping of HttpStatusCode to expiration times. If unspecified takes a default value.</param> /// <param name="cache">The distributed cache to use.</param> /// /// <param name="statsProvider">An <see cref="IStatsProvider"/> that records statistic information about the caching behavior.</param> internal RedisCacheHandler(HttpMessageHandler innerHandler, IDictionary <HttpStatusCode, TimeSpan> cacheExpirationPerHttpResponseCode, IDistributedCache cache, IStatsProvider statsProvider = null) : base(innerHandler ?? new HttpClientHandler()) { this.StatsProvider = statsProvider ?? new StatsProvider(nameof(RedisCacheHandler)); this.cacheExpirationPerHttpResponseCode = cacheExpirationPerHttpResponseCode ?? new Dictionary <HttpStatusCode, TimeSpan>(); responseCache = cache; }
public ContentManager(IWarmingRepository warmingRepository, IOenRepository oenRepository, IRedirectLinkService redirectLinkService, IStatsProvider statsProvider) { _warmingRepository = warmingRepository; _oenRepository = oenRepository; _redirectLinkService = redirectLinkService; _statsProvider = statsProvider; }
/// <summary> /// Used for injecting an IMemoryCache for unit testing purposes. /// </summary> /// <param name="innerHandler">The inner handler to retrieve the content from on cache misses.</param> /// <param name="cacheExpirationPerHttpResponseCode"> /// A mapping of HttpStatusCode to expiration times. If unspecified takes /// a default value. /// </param> /// <param name="statsProvider"> /// An <see cref="IStatsProvider" /> that records statistic information about the caching /// behavior. /// </param> /// <param name="cache">The cache to be used.</param> internal InMemoryCacheHandler(HttpMessageHandler innerHandler, IDictionary <HttpStatusCode, TimeSpan> cacheExpirationPerHttpResponseCode, IStatsProvider statsProvider, IMemoryCache cache) : base(innerHandler ?? new HttpClientHandler()) { this.StatsProvider = statsProvider ?? new StatsProvider(nameof(InMemoryCacheHandler)); this.cacheExpirationPerHttpResponseCode = cacheExpirationPerHttpResponseCode ?? new Dictionary <HttpStatusCode, TimeSpan>(); this.responseCache = cache ?? new MemoryCache(new MemoryCacheOptions()); }
/// <summary> /// Used for injecting an IMemoryCache for unit testing purposes. /// </summary> /// <param name="innerHandler">The inner handler to retrieve the content from on cache misses.</param> /// <param name="maxTimeout">The maximum timeout to wait for the service to respond.</param> /// <param name="cacheDuration">The maximum time span the item should be remained in the cache if not renewed before then.</param> /// <param name="statsProvider">An <see cref="IStatsProvider"/> that records statistic information about the caching behavior.</param> /// <param name="cache">The cache to be used.</param> internal InMemoryCacheFallbackHandler(HttpMessageHandler innerHandler, TimeSpan maxTimeout, TimeSpan cacheDuration, IStatsProvider statsProvider, IMemoryCache cache) : base(innerHandler ?? new HttpClientHandler()) { this.StatsProvider = statsProvider ?? new StatsProvider(nameof(InMemoryCacheHandler)); this.maxTimeout = maxTimeout; this.cacheDuration = cacheDuration; responseCache = cache ?? new MemoryCache(new MemoryCacheOptions()); }
public static void Add(IStatsProvider statsProvider, ComplexGraphType <object> type) { type.Field <ListGraphType <StatType> >("stats", arguments: new QueryArguments { new QueryArgument(typeof(StringGraphType)) { Name = "team1", Description = "Team 1" }, new QueryArgument(typeof(StringGraphType)) { Name = "team2", Description = "Team 2" } }, resolve: context => { var c = context as ResolveFieldContext; var team1 = c.Arguments["team1"].ToString(); var team2 = c.Arguments["team2"].ToString(); return(statsProvider.GetStatsAsync(team1, team2).Result); }); }
/// <summary> /// Used internally only for unit testing. /// </summary> /// <param name="innerHandler">The inner handler to retrieve the content from on cache misses.</param> /// <param name="cacheExpirationPerHttpResponseCode">A mapping of HttpStatusCode to expiration times. If unspecified takes a default value.</param> /// <param name="cache">The distributed cache to use.</param> /// /// <param name="statsProvider">An <see cref="IStatsProvider"/> that records statistic information about the caching behavior.</param> internal RedisCacheHandler(HttpMessageHandler innerHandler, IDictionary<HttpStatusCode, TimeSpan> cacheExpirationPerHttpResponseCode, IDistributedCache cache, IStatsProvider statsProvider = null) : base(innerHandler ?? new HttpClientHandler()) { this.StatsProvider = statsProvider ?? new StatsProvider(nameof(RedisCacheHandler)); this.cacheExpirationPerHttpResponseCode = cacheExpirationPerHttpResponseCode ?? new Dictionary<HttpStatusCode, TimeSpan>(); responseCache = cache; }
/// <summary> /// Used internally only for unit testing. /// </summary> /// <param name="innerHandler">The inner handler to retrieve the content from on cache misses.</param> /// <param name="maxTimeout">The maximum timeout to wait for the service to respond.</param> /// <param name="cacheDuration">The maximum time span the item should be remained in the cache if not renewed before then.</param> /// <param name="cache">The distributed cache to use.</param> /// /// <param name="statsProvider">An <see cref="IStatsProvider"/> that records statistic information about the caching behavior.</param> internal RedisCacheFallbackHandler(HttpMessageHandler innerHandler, TimeSpan maxTimeout, TimeSpan cacheDuration, IDistributedCache cache, IStatsProvider statsProvider = null) : base(innerHandler ?? new HttpClientHandler()) { this.StatsProvider = statsProvider ?? new StatsProvider(nameof(RedisCacheHandler)); this.maxTimeout = maxTimeout; this.cacheDuration = cacheDuration; responseCache = cache; }
public ApplicationModel() { #if DEBUG Stats = new Data.Debug.DebugStatsProvider(); #else Stats = new VkStatsProvider(); #endif MapView = new MapView(new IpApiGeoLocationProvider()); Photos = new PhotoCollection(new VkPhotoProvider()); LocalFiles = new LocalFileCollection(); Users = new Users(new VkUserProvider()); }
public FplStats(IStatsProvider statsProvider, IFplDataManager fplDataManager, IModelCalculator modelCalculator, ISettingDataManager settingDataManager) { _statsProvider = statsProvider; _fplDataManager = fplDataManager; _modelCalculator = modelCalculator; var result = settingDataManager.GetAllSettings(); if (!result.Status) { throw new Exception(); } Utility.SetAllSettings(result.DataObject); }
public void Register(IStatsProvider provider) { foreach (var stat in provider.Stats) { if (stat == null || string.IsNullOrEmpty(stat.Key)) { Core.Support.LogError(this, "trying to register an invalid stat (null or empty key)"); continue; } IStat existedStat; if (_stats.TryGetValue(stat.Key, out existedStat)) { Core.Support.LogError(this, string.Format( "a stat with the key '{0}' (name='{1}') is already existed. it will be replaced with the new one (name='{2}')", stat.Key, stat.Name, existedStat.Name)); } _stats[stat.Key] = stat; } }
public WarmingManager ( IWarmingWordsProvider wordsProvider, IWarmingService warmingService, IUsedWordsRepository usedWordsRepository, IWarmingRepository warmingRepository, IOenRepository oenRepository, IHeatRepository heatRepository, IContentManager contentManager, IStatsProvider statsProvider) { _wordsProvider = wordsProvider; _warmingService = warmingService; _warmingService.OnReport += NotificationReport; _warmingService.OnError += NotificationError; _usedWordsRepository = usedWordsRepository; _warmingRepository = warmingRepository; _oenRepository = oenRepository; _heatRepository = heatRepository; _contentManager = contentManager; _statsProvider = statsProvider; }
/// <summary> /// Used for injecting an IMemoryCache for unit testing purposes. /// </summary> /// <param name="innerHandler">The inner handler to retrieve the content from on cache misses.</param> /// <param name="cacheExpirationPerHttpResponseCode">A mapping of HttpStatusCode to expiration times. If unspecified takes a default value.</param> /// <param name="options">Options to use to connect to Redis.</param> /// /// <param name="statsProvider">An <see cref="IStatsProvider"/> that records statistic information about the caching behavior.</param> public RedisCacheHandler(HttpMessageHandler innerHandler, IDictionary <HttpStatusCode, TimeSpan> cacheExpirationPerHttpResponseCode, RedisCacheOptions options, IStatsProvider statsProvider = null) : this(innerHandler, cacheExpirationPerHttpResponseCode, new RedisCache(options), statsProvider) { }
public WarmingService(OenContext context, IOenRepository oenRepository, IStatsProvider statsProvider) { _context = context; _oenRepository = oenRepository; _statsProvider = statsProvider; }
public SpecializationStats(IStatsProvider wrappedEntity, PlayerSpecialization specialization) : base(wrappedEntity) { this.specialization = specialization; }
public StatsController(IStatsProvider statsProvider) { _statsProvider = statsProvider; }
/// <summary> /// Create a new InMemoryCacheHandler. /// </summary> /// <param name="innerHandler">The inner handler to retrieve the content from on cache misses.</param> /// <param name="maxTimeout">The maximum timeout to wait for the service to respond.</param> /// <param name="cacheDuration">The maximum time span the item should be remained in the cache if not renewed before then.</param> /// <param name="statsProvider">An <see cref="IStatsProvider"/> that records statistic information about the caching behavior.</param> public InMemoryCacheFallbackHandler(HttpMessageHandler innerHandler, TimeSpan maxTimeout, TimeSpan cacheDuration, IStatsProvider statsProvider = null) : this(innerHandler, maxTimeout, cacheDuration, statsProvider, new MemoryCache(new MemoryCacheOptions())) { }
/// <summary> /// Used for injecting an IMemoryCache for unit testing purposes. /// </summary> /// <param name="innerHandler">The inner handler to retrieve the content from on cache misses.</param> /// <param name="cacheExpirationPerHttpResponseCode">A mapping of HttpStatusCode to expiration times. If unspecified takes a default value.</param> /// <param name="statsProvider">An <see cref="IStatsProvider"/> that records statistic information about the caching behavior.</param> /// <param name="cache">The cache to be used.</param> internal InMemoryCacheHandler(HttpMessageHandler innerHandler, IDictionary<HttpStatusCode, TimeSpan> cacheExpirationPerHttpResponseCode, IStatsProvider statsProvider, IMemoryCache cache) : base(innerHandler ?? new HttpClientHandler()) { this.StatsProvider = statsProvider ?? new StatsProvider(nameof(InMemoryCacheHandler)); this.cacheExpirationPerHttpResponseCode = cacheExpirationPerHttpResponseCode ?? new Dictionary<HttpStatusCode, TimeSpan>(); responseCache = cache ?? new MemoryCache(new MemoryCacheOptions()); }
/// <summary> /// Create a new InMemoryCacheHandler. /// </summary> /// <param name="innerHandler">The inner handler to retrieve the content from on cache misses.</param> /// <param name="cacheExpirationPerHttpResponseCode">A mapping of HttpStatusCode to expiration times. If unspecified takes a default value.</param> /// <param name="statsProvider">An <see cref="IStatsProvider"/> that records statistic information about the caching behavior.</param> public InMemoryCacheHandler(HttpMessageHandler innerHandler, IDictionary<HttpStatusCode, TimeSpan> cacheExpirationPerHttpResponseCode = null, IStatsProvider statsProvider = null) : this(innerHandler, cacheExpirationPerHttpResponseCode, statsProvider, new MemoryCache(new MemoryCacheOptions())) {}
public SoccerQuery(ITeamsProvider teamsProvider, IStatsProvider statsProvider) { Teams.Add(teamsProvider, this); Stats.Add(statsProvider, this); WinnigStats.Add(statsProvider, this); }
public Player() { provider = new CategoryStats(category); provider = new SpecializationStats(provider, specialization); provider = new MultiplierStats(provider, 2); }
public void AddStatsProvider(IStatsProvider statsProvider) { statsProviders.Add(statsProvider); }
/// <summary> /// Used for injecting an IMemoryCache for unit testing purposes. /// </summary> /// <param name="innerHandler">The inner handler to retrieve the content from on cache misses.</param> /// <param name="maxTimeout">The maximum timeout to wait for the service to respond.</param> /// <param name="cacheDuration">The maximum time span the item should be remained in the cache if not renewed before then.</param> /// <param name="options">Options to use to connect to Redis.</param> /// /// <param name="statsProvider">An <see cref="IStatsProvider"/> that records statistic information about the caching behavior.</param> public RedisCacheFallbackHandler(HttpMessageHandler innerHandler, TimeSpan maxTimeout, TimeSpan cacheDuration, RedisCacheOptions options, IStatsProvider statsProvider = null) : this(innerHandler, maxTimeout, cacheDuration, new RedisCache(options), statsProvider) { }
/// <summary> /// Used for injecting an IMemoryCache for unit testing purposes. /// </summary> /// <param name="innerHandler">The inner handler to retrieve the content from on cache misses.</param> /// <param name="cacheExpirationPerHttpResponseCode">A mapping of HttpStatusCode to expiration times. If unspecified takes a default value.</param> /// <param name="options">Options to use to connect to Redis.</param> /// /// <param name="statsProvider">An <see cref="IStatsProvider"/> that records statistic information about the caching behavior.</param> public RedisCacheHandler(HttpMessageHandler innerHandler, IDictionary<HttpStatusCode, TimeSpan> cacheExpirationPerHttpResponseCode, RedisCacheOptions options, IStatsProvider statsProvider = null) : this(innerHandler, cacheExpirationPerHttpResponseCode, new RedisCache(options), statsProvider) {}
/// <summary> /// Initializes a new instance of the <see cref="BaseRowProcessor"/> class. /// </summary> /// <param name="statsProvider">Statistical provider to generate key.</param> /// <param name="logger">A <see cref="ILogger"/> instance.</param> protected BaseRowProcessor(IStatsProvider statsProvider, ILogger logger) { _statsProvider = statsProvider; _logger = logger; }
/// <summary> /// Create a new InMemoryCacheHandler. /// </summary> /// <param name="innerHandler">The inner handler to retrieve the content from on cache misses.</param> /// <param name="cacheExpirationPerHttpResponseCode"> /// A mapping of HttpStatusCode to expiration times. If unspecified takes /// a default value. /// </param> /// <param name="statsProvider"> /// An <see cref="IStatsProvider" /> that records statistic information about the caching /// behavior. /// </param> public InMemoryCacheHandler(HttpMessageHandler innerHandler = null, IDictionary <HttpStatusCode, TimeSpan> cacheExpirationPerHttpResponseCode = null, IStatsProvider statsProvider = null) : this(innerHandler, cacheExpirationPerHttpResponseCode, statsProvider, new MemoryCache(new MemoryCacheOptions())) { }
/// <summary> /// Initializes a new instance of the <see cref="JHopkinsRowProcessor"/> class. /// </summary> /// <param name="namesService">Names service to translate name and abbreviations.</param> /// <param name="statsProvider">Statistical provider to generate key.</param> /// <param name="logger">A <see cref="ILogger"/> instance.</param> public JHopkinsRowProcessor(INames namesService, IStatsProvider statsProvider, ILogger logger) : base(statsProvider, logger) { _namesService = namesService; }
protected StatsDecorator(IStatsProvider wrappedEntity) { this.wrappedEntity = wrappedEntity; }
public MultiplierStats(IStatsProvider wrappedEntity, float multiplier) : base(wrappedEntity) { this.multiplier = multiplier; }
/// <summary> /// Initializes a new instance of the <see cref="YandexRussiaRowProcessor"/> class. /// </summary> /// <param name="statsProvider">Statistical provider to generate key.</param> /// <param name="logger">A <see cref="ILogger"/> instance.</param> public YandexRussiaRowProcessor(IStatsProvider statsProvider, ILogger logger) : base(statsProvider, logger) { }
/// <summary> /// Initializes a new instance of the <see cref="StatsService"/> class. /// </summary> /// <param name="provider">The stats-related data provider..</param> /// <param name="environmentalDataRepository">The environmental data repository.</param> public StatsService(IStatsProvider provider, IEnvironmentalDataRepository environmentalDataRepository) { Provider = provider; EnvironmentalDataRepository = environmentalDataRepository; }