private void RefreshThrottleStrategyInCache(string requestKey, IThrottleStrategy throttleStrategy)
 {
     if (Context.Cache[requestKey] == null)
     {
         AddToCache(requestKey, throttleStrategy);
     }
 }
 public Throttler(IThrottleStrategy strategy)
 {
     if (strategy == null)
     {
         throw new ArgumentNullException("strategy");
     }
     Strategy = strategy;
 }
示例#3
0
 public Throttler(IThrottleStrategy strategy)
 {
     if (strategy == null)
     {
         throw new ArgumentNullException("strategy");
     }
     this.strategy = strategy;
 }
 private void AddToCache(string requestKey, IThrottleStrategy throttleStrategy)
 {
     Context.Cache.Add(
         requestKey,
         throttleStrategy,
         null,
         DateTime.Now.AddSeconds(CacheExpirationPeriodMilliseconds),
         Cache.NoSlidingExpiration,
         CacheItemPriority.Low,
         null);
 }
示例#5
0
 public Throttler(IThrottleStrategy strategy)
 {
     this.strategy = strategy ?? throw new ArgumentNullException(nameof(strategy));
 }
示例#6
0
 public Throttler(IThrottleStrategy strategy)
 {
     Strategy = strategy ?? throw new ArgumentNullException("strategy");
 }