TsgcWSAPIKeyManager › Properties › RateLimit
Per-key rate-limit metadata (max requests per window) consumed by TsgcWSRateLimiter.PerAPIKey.
property RateLimit: TsgcAPIKeyRateLimit read FRateLimit write SetRateLimit;
—
Stores per-key rate-limit defaults alongside each issued key: DefaultMaxRequests requests every DefaultWindowSec seconds. These values are informational hints — the API key manager itself does not throttle traffic. Enforcement is delegated to a paired TsgcWSRateLimiter instance with its PerAPIKey scope enabled, which reads the per-key budget and applies token-bucket / sliding-window throttling. Typical use is tiered SaaS: provision free-tier customers at 100 req/hour, Pro at 10 000, Enterprise at 1 000 000 and have a single rate-limiter component apply the right budget to each incoming request automatically.
// Default tier: 100 requests per hour per API key
sgcWSAPIKeyManager1.RateLimit.Enabled := True;
sgcWSAPIKeyManager1.RateLimit.DefaultMaxRequests := 100;
sgcWSAPIKeyManager1.RateLimit.DefaultWindowSec := 3600;
// Pair with TsgcWSRateLimiter.PerAPIKey for actual throttling
sgcWSRateLimiter1.PerAPIKey.Enabled := True;