C# 클래스 GSF.Threading.RateLimiter

A rate limiting system based on tokes.
파일 보기 프로젝트 열기: GridProtectionAlliance/gsf 1 사용 예제들

공개 메소드들

메소드 설명
RateLimiter ( double tokensPerSecond = 10, int maxTokensQueue = 10 ) : System

Creates a RateLimiter

TryTakeToken ( ) : bool

Attempts to take a token from the rate limiter.

UpdateLimits ( double tokensPerSecond, int maxTokensQueue ) : void

Updates the limits associated with this rate limiter. Note, after this update, the tokens will be completely resupplied.

메소드 상세

RateLimiter() 공개 메소드

Creates a RateLimiter
public RateLimiter ( double tokensPerSecond = 10, int maxTokensQueue = 10 ) : System
tokensPerSecond double The number of tokens per second that can be generated. Must be greater than zero and less than 1 billion
maxTokensQueue int The maximum number of tokens in the queue. Must be at least 1
리턴 System

TryTakeToken() 공개 메소드

Attempts to take a token from the rate limiter.
public TryTakeToken ( ) : bool
리턴 bool

UpdateLimits() 공개 메소드

Updates the limits associated with this rate limiter. Note, after this update, the tokens will be completely resupplied.
public UpdateLimits ( double tokensPerSecond, int maxTokensQueue ) : void
tokensPerSecond double The number of tokens per second that can be generated. Must be greater than zero and less than 1 billion
maxTokensQueue int The maximum number of tokens in the queue. Must be at least 1
리턴 void