public static void Setup(string @namespace = Constants.DefaultNamespace, Granularity[] granularities = null) { if (options == null && lazyConnector == null) { options = new RateContext(@namespace, granularities ?? new Granularity[] { Granularity.Second, Granularity.Minute, Granularity.Hour, Granularity.Day }); lazyConnector = new Lazy <RedisClient>(() => { return(RedisClientFactory.Connect("cache")); }); } }
internal Counter(RedisClient redisConnection, IRateContext context) { if (redisConnection == null) { throw new ArgumentNullException("connectionProvider"); } if (context == null) { throw new ArgumentNullException("context"); } this.redisConnection = redisConnection; this.context = context; this.DB = this.redisConnection.GetDatabase(); }
internal Limiter(RedisClient redisConnection, IRateContext context) { if (redisConnection == null) { throw new ArgumentNullException("connectionProvider"); } if (context == null) { throw new ArgumentNullException("context"); } this.redisConnection = redisConnection; this.context = context; this.DB = this.redisConnection.GetDatabase(); this.Interval = Granularity.Second.Ttl; }