Class RateLimitBucket
Inheritance
System.Object
Inherited Members
Show
Syntax
public class RateLimitBucket
Constructors
RateLimitBucket(Double, RateLimitBucket.RefillConfig)
Declaration
public RateLimitBucket(double now, RateLimitBucket.RefillConfig config)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | now | |
| Mirage.SocketLayer.RateLimitBucket.RefillConfig | config |
Fields
Config
Declaration
public readonly RateLimitBucket.RefillConfig Config
Methods
CheckRefill(Double)
refills tokens based on config
Declaration
public void CheckRefill(double now)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | now | seconds |
UseTokens(Int32)
subtracts cost from token count, returns true if tokens is negative (we ran out)
Declaration
public bool UseTokens(int cost)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | cost |
Returns
| Type | Description |
|---|---|
| System.Boolean |
IsEmpty()
returns true if tokens is negative (we ran out)
Declaration
public bool IsEmpty()
Returns
| Type | Description |
|---|---|
| System.Boolean |