This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// <summary> | |
| /// Rate limiter that replenishes tokens periodically. | |
| /// </summary> | |
| /// <remarks> | |
| /// This is a simpler and lock-free implementation of System.Threading.RateLimiting.TokenBucketRateLimiter. | |
| /// </remarks> | |
| /// <example> | |
| /// <code lang='C#'>// Throttle logs to 10 by minute. | |
| /// TokenBucketRateLimiterSlim rateLimiter = new(10, TimeSpan.FromMinutes(1)); | |
| /// if (rateLimiter.AttemptAcquire()) |