TsgcWSRateLimiter › Methods

TsgcWSRateLimiter Methods

Public methods grouped by purpose, followed by the full alphabetical list.

Allowance checks

NameDescription
IsAllowedReturns True if a request of the given cost is allowed for the specified key.
ConsumeConsumes cost tokens and returns a detailed TsgcRateLimitResult.
IsConnectionAllowedServer hook: returns True if a new connection from IP passes rate limiting.
IsMessageAllowedServer hook: returns True if a message from IP passes rate limiting.

Tracking

NameDescription
RegisterConnectionRegisters a new connection for tracking (called automatically by the server).
UnregisterConnectionRemoves a connection from tracking (called automatically on disconnect).

Reset

NameDescription
ResetClears the counters for a single key.
ResetAllClears every internal counter and resets the Stats object.

Persistence

NameDescription
SaveStateToFilePersists all buckets and counters to the given file.
LoadStateFromFileRestores buckets and counters previously saved to a file.
SaveStateToStreamPersists the internal state to an arbitrary TStream.
LoadStateFromStreamRestores the internal state from an arbitrary TStream.

All Methods (alphabetical)

NameDescription
ConsumeConsumes cost tokens and returns a detailed TsgcRateLimitResult.
IsAllowedReturns True if a request of the given cost is allowed for the specified key.
IsConnectionAllowedServer hook: returns True if a new connection from IP passes rate limiting.
IsMessageAllowedServer hook: returns True if a message from IP passes rate limiting.
LoadStateFromFileRestores buckets and counters previously saved to a file.
LoadStateFromStreamRestores the internal state from an arbitrary TStream.
RegisterConnectionRegisters a new connection for tracking (called automatically by the server).
ResetClears the counters for a single key.
ResetAllClears every internal counter and resets the Stats object.
SaveStateToFilePersists all buckets and counters to the given file.
SaveStateToStreamPersists the internal state to an arbitrary TStream.
UnregisterConnectionRemoves a connection from tracking (called automatically on disconnect).