View on GitHub

Throttle

Throttle

Action throttle in a period.

If you want execute some action 10 times in one second, you can use it like this:

InProcess

Throttle TS = new Throttle("ThrottleName", TimeSpan.FromSeconds(1), 10);
...
this.TS.Execute(()=> ...);
...

Cross Process

var conn = RedisExchangeManager.GetConnection("Throttle");
this.Counter = new RedisCounter(conn);
this.TS = new Throttle("ThrottleName", TimeSpan.FromSeconds(1), 10, counter:this.Counter);

NUGET

AsNum.Throttle

AsNum.Throttle.Redis