Q13 Redis Domain 2 · 25–30% of exam Priority · Real Exam

Which pattern implements a fixed-window rate limiter of 100 requests per minute per user?

  1. A INCR on a key including the minute, with EXPIRE 60 on first increment (correct answer)
  2. B LPUSH then LLEN
  3. C SETNX only
  4. D ZADD with the timestamp as score

Shortcut: INCR on a key such as rl:{user}:{minute} is atomic; setting EXPIRE when the counter is first created makes the window self-cleaning. A sorted set supports sliding windows at higher cost.