24 lines
731 B
C#
24 lines
731 B
C#
namespace Tiku.Application.Security;
|
|
|
|
public sealed record DistributedRateLimitBucket(string Key, int PermitLimit, TimeSpan Window);
|
|
|
|
public sealed record DistributedRateLimitResult(bool Allowed, TimeSpan? RetryAfter = null);
|
|
|
|
public interface IRedisSecurityStore
|
|
{
|
|
bool IsConfigured { get; }
|
|
|
|
Task<DistributedRateLimitResult> ConsumeAsync(
|
|
IReadOnlyCollection<DistributedRateLimitBucket> buckets,
|
|
CancellationToken cancellationToken = default);
|
|
|
|
Task<bool> PingAsync(CancellationToken cancellationToken = default);
|
|
|
|
Task SetInvalidationVersionAsync(
|
|
string realm,
|
|
Guid? tenantId,
|
|
Guid? userId,
|
|
long version,
|
|
CancellationToken cancellationToken = default);
|
|
}
|