Show / Hide Table of Contents

Interface ITokenBucket

This interface defines a token bucket system. One instance represents one recurring bucket with a certain limit of tokens per timespan.

Namespace: MingweiSamuel.Camille.Util
Assembly: Camille.dll
Syntax
public interface ITokenBucket

Methods

| Improve this Doc View Source

GetDelay()

Get the delay til the next available token, or -1 if a token is available.

Declaration
long GetDelay()
Returns
Type Description
System.Int64

Delay in ticks or -1

| Improve this Doc View Source

GetTickSpan()

Get the timespan of this bucket in ticks.

Declaration
long GetTickSpan()
Returns
Type Description
System.Int64

Timespan of the bucket.

| Improve this Doc View Source

GetTokens(Int32)

Gets n tokens, regardless of whether they are available.

Declaration
bool GetTokens(int n)
Parameters
Type Name Description
System.Int32 n

Number of tokens to take.

Returns
Type Description
System.Boolean

True if the tokens were obtained without violating limits, false otherwise.

| Improve this Doc View Source

GetTotalLimit()

Get the total limit of this bucket per timespan.

Declaration
int GetTotalLimit()
Returns
Type Description
System.Int32

Total limit per timespan.

Extension Methods

TokenBucketUtils.ToLimitString(ITokenBucket)
  • Improve this Doc
  • View Source
Back to top Generated by DocFX