Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

RATELIMIT.PEEK

Last updated
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.

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' command if the argument count is wrong.
  • NOLICENSE rate-limiting requires a HotKV license. Contact sales@hotkv.com if your license does not include the rate-limiting feature.
127.0.0.1:6379> RATELIMIT.CHECK api user:2
1) (integer) 1
2) (integer) 99
3) (integer) 0
4) (integer) 100
5) (integer) 0
127.0.0.1:6379> RATELIMIT.PEEK api user:2
1) (integer) 1
2) (integer) 99
3) (integer) 0
4) (integer) 100
5) (integer) 1

HotKV-only command. Redis and Valkey have no equivalent.

RATELIMIT.CREATE, RATELIMIT.CHECK, RATELIMIT.RESET, RATELIMIT.STATS, RATELIMIT.DROP, RATELIMIT.LIST, AI features guide