Technology, Software Development, Dotnet Core, API, Rate Limiting.
$"rate_limit_{context.Request.Path}_{DateTime.UtcNow.Ticks / windowSize.Ticks}"; var cache = context.RequestServices.GetRequiredService<IDistributedCache>(); var counter = Convert.ToInt32(await cache.GetStringAsync(key)) + 1; if (counter > maxRequests) { context.Response.StatusCode = 429; await