A team needs rate limiting per API client in Redis. Which approach correctly counts requests within a sliding window?
- A INCR with fixed TTL (fixed window)
- B Sorted Set with ZADD timestamp, ZREMRANGEBYSCORE, ZCARD (sliding window) (correct answer)
- C List with LPUSH/LLEN
- D Hash with HINCR
Shortcut: The sliding window rate limiter stores request timestamps in a Sorted Set, removes entries older than the window (ZREMRANGEBYSCORE), and counts remaining entries (ZCARD) to determine if the limit is exceeded.