Table of Contents

Class RateLimitBucket

Namespace
Fluxer.Net.RateLimiting
Assembly
Fluxer.Net.dll

Represents a sliding window rate limit bucket for API requests

public class RateLimitBucket
Inheritance
object
RateLimitBucket

Constructors

RateLimitBucket(string, int, int, bool)

public RateLimitBucket(string bucketKey, int limit, int windowMs, bool exemptFromGlobal = false)

Parameters

bucketKey string
limit int
windowMs int
exemptFromGlobal bool

Properties

BucketKey

public string BucketKey { get; }

Property Value

string

ExemptFromGlobal

public bool ExemptFromGlobal { get; }

Property Value

bool

Limit

public int Limit { get; }

Property Value

int

WindowMs

public int WindowMs { get; }

Property Value

int

Methods

AcquireAsync()

Attempts to acquire a rate limit slot, waiting if necessary

public Task<int> AcquireAsync()

Returns

Task<int>

Time in milliseconds until the request can proceed (0 if immediate)

GetRemainingAsync()

Gets the number of available requests in the current window

public Task<int> GetRemainingAsync()

Returns

Task<int>

GetResetTimeAsync()

Gets the time in milliseconds until the next slot becomes available

public Task<int> GetResetTimeAsync()

Returns

Task<int>

ResetAsync()

Clears all tracked timestamps (useful for testing or manual reset)

public Task ResetAsync()

Returns

Task