C# Class Bert.RateLimiters.TokenBucket

Inheritance: IThrottleStrategy
Show file Open project: robertmircea/RateLimiters

Protected Properties

Property Type Description
bucketTokenCapacity long
nextRefillTime long
ticksRefillInterval long
tokens long

Public Methods

Method Description
ShouldThrottle ( System.TimeSpan &waitTime ) : bool
ShouldThrottle ( long n = 1 ) : bool
ShouldThrottle ( long n, System.TimeSpan &waitTime ) : bool

Protected Methods

Method Description
TokenBucket ( long bucketTokenCapacity, long refillInterval, long refillIntervalInMilliSeconds ) : System
UpdateTokens ( ) : void

Method Details

ShouldThrottle() public method

public ShouldThrottle ( System.TimeSpan &waitTime ) : bool
waitTime System.TimeSpan
return bool

ShouldThrottle() public method

public ShouldThrottle ( long n = 1 ) : bool
n long
return bool

ShouldThrottle() public method

public ShouldThrottle ( long n, System.TimeSpan &waitTime ) : bool
n long
waitTime System.TimeSpan
return bool

TokenBucket() protected method

protected TokenBucket ( long bucketTokenCapacity, long refillInterval, long refillIntervalInMilliSeconds ) : System
bucketTokenCapacity long
refillInterval long
refillIntervalInMilliSeconds long
return System

UpdateTokens() protected abstract method

protected abstract UpdateTokens ( ) : void
return void

Property Details

bucketTokenCapacity protected property

protected long bucketTokenCapacity
return long

nextRefillTime protected property

protected long nextRefillTime
return long

ticksRefillInterval protected property

protected long ticksRefillInterval
return long

tokens protected property

protected long tokens
return long