ThrottlingSentinelFilter Class
Definition
- Namespace
- Cuemon.AspNetCore.Mvc.Filters.Throttling
- Assemblies
- Cuemon.AspNetCore.Mvc.dll
A filter that provides an API throttling sentinel on action methods.
public class ThrottlingSentinelFilter : ConfigurableAsyncActionFilter<ThrottlingSentinelOptions>, IConfigurable<ThrottlingSentinelOptions>, IAsyncActionFilter, IFilterMetadata
- Inheritance
-
ThrottlingSentinelFilter
- Implements
- Inherited Members
Examples
The following example constructs directly with a packet-local throttling cache and options object.
using System;
using Cuemon;
using Cuemon.AspNetCore.Http.Throttling;
using Cuemon.AspNetCore.Mvc.Filters.Throttling;
using Microsoft.Extensions.Options;
namespace MyApp.Examples;
public static class ThrottlingSentinelFilterExample
{
public static void Demonstrate()
{
var options = Options.Create(new ThrottlingSentinelOptions
{
ContextResolver = _ => "developer-workstation",
Quota = new ThrottleQuota(10, 5, TimeUnit.Seconds)
});
var filter = new ThrottlingSentinelFilter(options, new MemoryThrottlingCache());
Console.WriteLine(filter.Options.Quota.RateLimit);
Console.WriteLine(filter.Options.UseRetryAfterHeader);
}
}
Constructors
| Name | Description |
|---|---|
| ThrottlingSentinelFilter(IOptions<ThrottlingSentinelOptions>, IThrottlingCache) | Initializes a new instance of the ThrottlingSentinelFilter class. |
Methods
| Name | Description |
|---|---|
| OnActionExecutionAsync(ActionExecutingContext, ActionExecutionDelegate) | Called asynchronously before the action, after model binding is complete. |