RATELIMIT.PEEK
RATELIMIT.PEEK name key
- Group
- Rate limiting
- Complexity
- O(1)
- Arity
- -3 (at least 3 words, counting the command name)
- Flags
- read-only, fast
- Keys
- first 1, last 1, step 1
- HotKV Cloud
- Performance and Scale
- On-Premise
- requires the rate-limiting license feature
Named rate limiters apply one policy (a limit, a window and an algorithm) separately to every key you check against them, such as a user id, an API key or an IP address. RATELIMIT.PEEK reports what RATELIMIT.CHECK would say
for a request costing 1 unit, without consuming it.
Return value
Section titled “Return value”| Case | RESP2 | RESP3 |
|---|---|---|
| Always | Array of five integers, as for RATELIMIT.CHECK |
Same |
The second element is the units available now (nothing is consumed), and the
fifth is the units in use. For a limiter that does not exist, every element is
0.
Errors:
ERR wrong number of arguments for 'ratelimit.peek' commandif the argument count is wrong.NOLICENSE rate-limiting requires a HotKV license. Contact sales@hotkv.comif your license does not include therate-limitingfeature.
Examples
Section titled “Examples”127.0.0.1:6379> RATELIMIT.CHECK api user:21) (integer) 12) (integer) 993) (integer) 04) (integer) 1005) (integer) 0127.0.0.1:6379> RATELIMIT.PEEK api user:21) (integer) 12) (integer) 993) (integer) 04) (integer) 1005) (integer) 1Compatibility
Section titled “Compatibility”HotKV-only command. Redis and Valkey have no equivalent.
See also
Section titled “See also”RATELIMIT.CREATE, RATELIMIT.CHECK, RATELIMIT.RESET, RATELIMIT.STATS, RATELIMIT.DROP, RATELIMIT.LIST, AI features guide
Was this page helpful?
Thanks for the feedback.