C# 클래스 Bert.RateLimiters.RollingWindowThrottler

Used to control the rate of occurrences of an action per unit of time.
The algorithm uses a rolling time window so that precise control over the rate is achieved (without any bursts)
파일 보기 프로젝트 열기: robertmircea/RateLimiters

공개 메소드들

메소드 설명
RollingWindowThrottler ( int occurrences, System.TimeSpan timeUnit ) : System

Constructs an instance of the throttler.

ShouldThrottle ( int tokens, long &waitTimeMillis ) : bool

Tries to reserve tokens in the configured time unit.

ShouldThrottle ( long &waitTimeMillis ) : bool

Tries to reserve one token in the configured time unit.

비공개 메소드들

메소드 설명
CheckExitTimeQueue ( ) : void

메소드 상세

RollingWindowThrottler() 공개 메소드

Constructs an instance of the throttler.
public RollingWindowThrottler ( int occurrences, System.TimeSpan timeUnit ) : System
occurrences int Maximum number of occurences per time unit allowed.
timeUnit System.TimeSpan The time unit in which the occurences are constrained.
리턴 System

ShouldThrottle() 공개 메소드

Tries to reserve tokens in the configured time unit.
public ShouldThrottle ( int tokens, long &waitTimeMillis ) : bool
tokens int total number of reservations
waitTimeMillis long total suggested wait time in milliseconds till tokens will become available for reservation
리턴 bool

ShouldThrottle() 공개 메소드

Tries to reserve one token in the configured time unit.
public ShouldThrottle ( long &waitTimeMillis ) : bool
waitTimeMillis long total suggested wait time in milliseconds till tokens will become available for reservation
리턴 bool