移动系统liao
2024-09-23 78028cee453a5878835a27f884ae36c0900fe8f7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace CoreCms.Net.Model.ViewModels.Options
{
    /// <summary>
    /// 限速设置器配置文件
    /// 用于UseRateLimiter
    /// </summary>
    public class MyRateLimitOptions
    {
        /// <summary>
        /// 限速器节点名称
        /// </summary>
        public const string MyRateLimit = "MyRateLimit";
 
        /// <summary>
        /// 一个窗口中允许的最大允许计数器数。 在将这些选项传递给 的FixedWindowRateLimiter构造函数时,必须设置为值 &gt; 0。
        /// </summary>
        public int PermitLimit { get; set; } = 100;
 
        /// <summary>
        /// 指定请求的时间范围。 必须设置为大于 Zero 将这些选项传递给 的构造函数 FixedWindowRateLimiter时的值。
        /// </summary>
        public int Window { get; set; } = 10;
 
        /// <summary>
        /// 当 AutoReplenishment 设置为 true 时,内部计时器每 ReplenishmentPeriod 时间补充一次令牌数;当 false 设置为 TryReplenish 时,应用必须对限制器调用 。
        /// </summary>
        public int ReplenishmentPeriod { get; set; } = 2;
 
        /// <summary>
        /// 排队的获取请求的最大累计允许计数。 将这些选项传递给 的FixedWindowRateLimiter构造函数时,必须设置为值 &gt;= 0。
        /// </summary>
        public int QueueLimit { get; set; } = 2;
 
        /// <summary>
        /// 
        /// </summary>
        public int SegmentsPerWindow { get; set; } = 8;
 
        /// <summary>
        /// 
        /// </summary>
        public int TokenLimit { get; set; } = 10;
 
        /// <summary>
        /// 
        /// </summary>
        public int TokenLimit2 { get; set; } = 20;
 
        /// <summary>
        /// 
        /// </summary>
        public int TokensPerPeriod { get; set; } = 4;
 
        /// <summary>
        /// 是否自动补货
        /// </summary>
        public bool AutoReplenishment { get; set; } = false;
 
    }
}