KeyedRateLimiter<TKey>
Class in Oadm.Sdk.Network · Oadm.Sdk.dll
Token buckets per client key (address, MAC) in a bounded LRU table plus one global bucket, shared by the network service plugins (NTP, DHCP). Thread safe; no allocations in the steady state (table nodes are reused once the table is full or entries expire). Floods of new keys only ever cost one table entry each, never more than KeyedRateLimitOptions.MaxClients entries.
public sealed class KeyedRateLimiter<TKey>Constructors
Section titled “Constructors”KeyedRateLimiter
Section titled “KeyedRateLimiter”KeyedRateLimiter(KeyedRateLimitOptions? options = null, TimeProvider? time = null)A limiter with options (defaults when null).
Properties
Section titled “Properties”ClientCount
Section titled “ClientCount”int ClientCount { get; }Clients currently tracked (bounded by KeyedRateLimitOptions.MaxClients).
Options
Section titled “Options”KeyedRateLimitOptions Options { get; }The limits.
Methods
Section titled “Methods”RateLimitResult Check(TKey client)Counts one request of client and says whether to handle it.
GloballyLimitedWithin
Section titled “GloballyLimitedWithin”bool GloballyLimitedWithin(TimeSpan window)The global limit dropped a request within window.