ThrottleRequest Class
Definition
- Namespace
- Cuemon.AspNetCore.Http.Throttling
- Assemblies
- Cuemon.AspNetCore.dll
Represents the request usage and quota in the context of throttling.
public class ThrottleRequest
- Inheritance
-
objectThrottleRequest
Examples
The following example demonstrates how to use to track HTTP request usage and quota in a throttling scenario.
using System;
namespace Cuemon.AspNetCore.Http.Throttling;
public static class ThrottleRequestExample
{
public static void Demonstrate()
{
var request = new ThrottleRequest(new ThrottleQuota(10, TimeSpan.FromMinutes(1)));
request.IncrementTotal();
Console.WriteLine(request.Total);
}
}
Constructors
| Name | Description |
|---|---|
| ThrottleRequest(ThrottleQuota) | Initializes a new instance of the ThrottleRequest class. |
Properties
| Name | Description |
|---|---|
| Expires | Gets the computed expiration value of a throttled rate limit. |
| Quota | Gets the throttling quota that defines the rate limit of HTTP requests. |
| Total | Gets the total amount of HTTP requests. |
Methods
| Name | Description |
|---|---|
| IncrementTotal() | Increments the total amount of HTTP requests by 1. |
| Refresh() | Evaluates and refreshes this instance when required (Expires and Total). |