constructorRateLimitLease
public RateLimitLease(bool isAcquired, int remainingPermits, TimeSpan? retryAfter, DateTimeOffset? resetTime)
Initializes a new instance of the `RateLimitLease` struct without a disposal callback or limit quota.
- isAcquired: bool
- A value indicating whether the requested permits were successfully leased
- remainingPermits: int
- The number of permits remaining in the active window
- retryAfter: TimeSpan?
- The duration to wait before retrying when rejected
- resetTime: DateTimeOffset?
- The absolute point in time when the rate limit counter resets
constructorRateLimitLease
public RateLimitLease(bool isAcquired, int remainingPermits, TimeSpan? retryAfter, DateTimeOffset? resetTime, Action? disposeAction)
Initializes a new instance of the `RateLimitLease` struct with a disposal callback.
- isAcquired: bool
- A value indicating whether the requested permits were successfully leased
- remainingPermits: int
- The number of permits remaining in the active window
- retryAfter: TimeSpan?
- The duration to wait before retrying when rejected
- resetTime: DateTimeOffset?
- The absolute point in time when the rate limit counter resets
- disposeAction: Action?
- The optional callback invoked when the lease is disposed
constructorRateLimitLease
public RateLimitLease(bool IsAcquired, int RemainingPermits, TimeSpan? RetryAfter = null, DateTimeOffset? ResetTime = null, Action? DisposeAction = null, int? Limit = null)
Initializes a new instance of RateLimitLease.
- IsAcquired: bool
- A value indicating whether the requested permits were successfully leased
- RemainingPermits: int
- The number of permits remaining in the active window
- RetryAfter: TimeSpan?
- The duration to wait before retrying when the lease is rejected
- ResetTime: DateTimeOffset?
- The absolute point in time when the rate limit counter resets
- DisposeAction: Action?
- The optional callback invoked when the lease is disposed
- Limit: int?
- The total permit limit or quota configured for the rate limiter
methodDeconstruct
public void Deconstruct(out bool isAcquired, out int remainingPermits, out TimeSpan? retryAfter, out DateTimeOffset? resetTime)
Deconstructs the lease into its acquisition state, remaining permits, retry interval, and reset time.
- isAcquired: out bool
- When this method returns, contains a value indicating whether permits were acquired
- remainingPermits: out int
- When this method returns, contains the remaining permits
- retryAfter: out TimeSpan?
- When this method returns, contains the retry-after duration
- resetTime: out DateTimeOffset?
- When this method returns, contains the reset timestamp
methodDeconstruct
public void Deconstruct(out bool isAcquired, out int remainingPermits, out TimeSpan? retryAfter, out DateTimeOffset? resetTime, out Action? disposeAction)
Deconstructs the lease into its acquisition state, remaining permits, retry interval, reset time, and disposal callback.
- isAcquired: out bool
- When this method returns, contains a value indicating whether permits were acquired
- remainingPermits: out int
- When this method returns, contains the remaining permits
- retryAfter: out TimeSpan?
- When this method returns, contains the retry-after duration
- resetTime: out DateTimeOffset?
- When this method returns, contains the reset timestamp
- disposeAction: out Action?
- When this method returns, contains the disposal callback
methodDispose
public void Dispose()
Inherits documentation from base type or interface.
methodRejected
public static RateLimitLease Rejected(TimeSpan retryAfter, DateTimeOffset? resetTime = null, int? limit = null)
Creates a rejected lease with the specified retry duration, reset time, and permit quota.
- retryAfter: TimeSpan
- The duration to wait before retrying the request
- resetTime: DateTimeOffset?
- The absolute point in time when the rate limit counter resets
- limit: int?
- The total permit limit configured for the rate limiter policy
Retorna: A new `RateLimitLease` representing a rejected lease.
methodSuccessful
public static RateLimitLease Successful(int remainingPermits, DateTimeOffset? resetTime = null)
Creates a successful lease with the specified remaining permits and optional reset time.
- remainingPermits: int
- The number of permits remaining in the active window
- resetTime: DateTimeOffset?
- The absolute point in time when the rate limit counter resets
Retorna: A new `RateLimitLease` representing a granted lease.
methodSuccessful
public static RateLimitLease Successful(int remainingPermits, DateTimeOffset? resetTime, Action? disposeAction)
Creates a successful lease with an optional disposal callback.
- remainingPermits: int
- The number of permits remaining in the active window
- resetTime: DateTimeOffset?
- The absolute point in time when the rate limit counter resets
- disposeAction: Action?
- The callback invoked when the lease is disposed
Retorna: A new `RateLimitLease` representing a granted lease.
methodSuccessful
public static RateLimitLease Successful(int remainingPermits, DateTimeOffset? resetTime, Action? disposeAction, int? limit)
Creates a successful lease with an optional disposal callback and policy quota limit.
- remainingPermits: int
- The number of permits remaining in the active window
- resetTime: DateTimeOffset?
- The absolute point in time when the rate limit counter resets
- disposeAction: Action?
- The callback invoked when the lease is disposed
- limit: int?
- The total permit limit configured for the rate limiter policy
Retorna: A new `RateLimitLease` representing a granted lease.
methodSuccessful
public static RateLimitLease Successful(int remainingPermits, DateTimeOffset? resetTime, int? limit)
Creates a successful lease with the specified remaining permits, reset time, and total permit quota.
- remainingPermits: int
- The number of permits remaining in the active window
- resetTime: DateTimeOffset?
- The absolute point in time when the rate limit counter resets
- limit: int?
- The total permit limit configured for the rate limiter policy
Retorna: A new `RateLimitLease` representing a granted lease.
propertyDisposeAction
public Action? DisposeAction { get; init; }
The optional callback invoked when the lease is disposed
propertyIsAcquired
public bool IsAcquired { get; init; }
A value indicating whether the requested permits were successfully leased
propertyLimit
public int? Limit { get; init; }
The total permit limit or quota configured for the rate limiter
propertyRemainingPermits
public int RemainingPermits { get; init; }
The number of permits remaining in the active window
propertyResetTime
public DateTimeOffset? ResetTime { get; init; }
The absolute point in time when the rate limit counter resets
propertyRetryAfter
public TimeSpan? RetryAfter { get; init; }
The duration to wait before retrying when the lease is rejected