TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/nimanikoo/Dotnet-RateLimiter/llms.txt
Use this file to discover all available pages before exploring further.
compose.yaml in Dotnet-RateLimiter bundles a RedisInsight container alongside the API and Redis services. RedisInsight is a GUI that lets you browse keys, inspect values, and watch TTL countdowns in real time — making it the fastest way to verify that your Lua-based rate limiter is writing keys correctly and that they expire on schedule.
Accessing RedisInsight
Once the stack is running (docker compose up), open your browser to:
localhost:
| Field | Value |
|---|---|
| Host | redis |
| Port | 6379 |
redis-insight container is on the same ratelimit-network bridge network as the redis container, so the hostname redis resolves correctly without any extra DNS configuration.
Docker Compose Configuration
Theredis-insight service is defined in compose.yaml as follows:
depends_on: redis directive ensures RedisInsight only starts after the Redis container is ready, and the shared ratelimit-network bridge lets it resolve the redis hostname directly.
What You Can Inspect
Rate limit keys created in real time
Every request that passes throughRedisRateLimitingMiddleware causes the Lua script to call INCR on a key with the following naming pattern:
user-123 hitting /api/weather produces:
192.168.1.10 produces:
TTL countdown
Select anyrate_limit:* key in RedisInsight and switch to the TTL view. You can watch the remaining seconds tick down in real time. When the window closes, the key disappears automatically and the counter resets for the next window.
Counter values
The value stored at each key is a plain integer set by Redis’sINCR command. Clicking a key shows the current count — for example 3 means the identity has made 3 requests in the current window. Once the count exceeds maxRequests, the Lua script returns 0 and the middleware responds with HTTP 429.
Key expiry
Keys are given a TTL by the LuaEXPIRE call on the first INCR (when the counter transitions from 0 to 1). When the TTL reaches 0, Redis deletes the key automatically. You can verify this in the Key expiry column of the key browser — no manual cleanup is required.
Practical Use Cases
- Debug why a specific user is being rate-limited — search for
rate_limit:user:<userId>:*and check the current counter value against theMaxRequestsconfigured on the[RedisRateLimit]attribute. - Verify correct key naming — confirm that authenticated requests produce
user:prefixed keys and anonymous requests produceguest:prefixed keys, matching the logic inRedisRateLimitingMiddleware. - Monitor Redis memory usage — use the RedisInsight memory analysis tab to measure how many bytes rate limit keys consume, especially under high-traffic conditions where many unique identities are active simultaneously.
