Technology, Software Development, Dotnet Core, API, Rate Limiting.
context.Response.WriteAsync("Rate limit exceeded. Try again later."); return; } await cache.SetStringAsync(key, counter.ToString(), new DistributedCacheEntryOptions { AbsoluteExpirationRelativeToNow = windowSize }); await next(); }); Code Explained The Fixed Window algorithm implementation uses a