TsgcWSRateLimiter › Properties › PerUser
Rate-limit rule scoped to a user identifier (keys prefixed user:).
property PerUser: TsgcRateLimitRule read FPerUser write SetPerUser;
—
Same structure as PerIP / PerAPIKey but keyed by an application-defined user identifier. The component recognizes keys that start with the prefix user: as user-scoped. Useful when a single user may connect from multiple devices or IPs and you want a single shared budget for that user — aggregating by IP would double-count, aggregating by user gives the budget you actually want to bill against.
// 1000 requests/day per authenticated user across all their devices
sgcWSRateLimiter1.PerUser.Enabled := True;
sgcWSRateLimiter1.PerUser.Strategy := rlsFixed;
sgcWSRateLimiter1.PerUser.MaxRequests := 1000;
sgcWSRateLimiter1.PerUser.WindowSec := 86400;
// Pass keys like 'user:alice@example.com' to Consume / IsAllowed