Exemplo n.º 1
0
        public HitRatioCounter CreateCounter(string hitRatioCounterService, params string[] lables)
        {
            var counter = new HitRatioCounter(hitRatioCounterService, lables);

            _counters.Add(counter);
            return(counter);
        }
Exemplo n.º 2
0
 public RedisCache(RedisOptions options, CacheHitRatioManager manager)
 {
     _options = options;
     _metricsTracingFactory =
         MetricsTracingFactory.CreateRedisMetricsFactory(nameof(RedisCache), _options.LongRequestTime);
     _serializeSettings = new JsonSerializerSettings
     {
         ContractResolver = new DefaultContractResolver {
             IgnoreShouldSerializeMembers = true
         }
     };
     _circuitBreakerPolicy = Policy.Handle <Exception>()
                             .CircuitBreakerAsync(_options.CircuitBreakerExceptionsCount, _options.CircuitBreakerSeconds);
     _policy = Policy.WrapAsync(Policy.TimeoutAsync(_options.RedisTimeout, TimeoutStrategy.Pessimistic),
                                _circuitBreakerPolicy);
     _counter = manager.CreateCounter(nameof(RedisCache));
 }