CL.THROTTLE
Syntax
1. CL.THROTTLE <key> <max_burst> <count per period> <period> [<quantity>]
Time complexity: O(1)
<https://redis.com/blog/redis-cell-rate-limiting-redis-module/>
ACL categories: @throttle
This command provides functionality for implementing a rate limit mechanism and is based on the Redis module called redis-cell.
Return
An array of 5 integers with the following values:
- Whether to limit the related action (0 for allowed, 1 for limited).
- The total limit of the key. (Equivalent to
X-RateLimit-Limit) - The remaining limit of the key. (Equivalent to
X-RateLimit-Remaining) - Number of seconds to wait until a retry if the related action should be limited, else -1. (Equivalent to
Retry-After) - Number of seconds until the limit is fully restored. (Equivalent to
X-RateLimit-Reset)
Examples
1. dragonfly> CL.THROTTLE USER1 0 1 10 1
2. 1) (integer) 0
3. 2) (integer) 1
4. 3) (integer) 0
5. 4) (integer) -1
6. 5) (integer) 11
7. dragonfly> CL.THROTTLE USER1 0 1 10 1
8. 1) (integer) 1
9. 2) (integer) 1
10. 3) (integer) 0
11. 4) (integer) 10
12. 5) (integer) 10
