Problem Statement
In a multi-instance API, what makes distributed rate limiting safe?
Explanation
Atomic operations ensure increments and expirations are consistent across nodes. LUA scripts in Redis let you read, decide, and write in one step.
Local caches can assist for reads but should not replace a single source of truth for limits.
Code Solution
SolutionRead Only
EVAL token_bucket.lua 1 user:key rate burst now
