Add rate-limit module: Bucket4j 8.21 token buckets on Redis in a Spring Boot 4.1 filter, per-user/per-key/global limits, 429 with Retry-After, two instances sharing one bucket

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b7rnC7jppGGdHGESvy
This commit is contained in:
Claude
2026-10-28 18:27:06 +00:00
parent 99a8a0df42
commit fd0cf9b527
37 changed files with 1705 additions and 1 deletions
@@ -0,0 +1,16 @@
== bucket: capacity 5, refill 5 tokens per 10 s
-- burst: five calls in the same instant
call 1: consumed=true remaining=4 waitForRefill=0s
call 2: consumed=true remaining=3 waitForRefill=0s
call 3: consumed=true remaining=2 waitForRefill=0s
call 4: consumed=true remaining=1 waitForRefill=0s
call 5: consumed=true remaining=0 waitForRefill=0s
call 6: consumed=false remaining=0 waitForRefill=2s
-- greedy refill: tokens trickle back at 1 per 2 s
after 1 s: available=0
after 2 s: available=1
after 4 s: available=2
after 8 s: available=4
-- intervally refill: nothing, then everything
after 9.999 s: available=0
after 10.000 s: available=5