Essential session storage is required to sign in. Optional analytics remain off unless you allow them.
Build three concurrency-sensitive features on Redis, getting atomicity right. (1) A RATE LIMITER — a per-user counter with a TTL (INCR + EXPIRE), or a sliding window via a sorted set / a Lua script to make it atomic. (2) A DISTRIBUTED LOCK using SET key value NX PX with a unique token and a safe release (compare-and-delete via Lua), and explain the failure modes (and that Redlock has caveats). (3) A simple work QUEUE using a list (LPUSH + BLPOP) OR a Stream with a consumer group + acknowledgments, and explain why Streams give at-least-once delivery that pub/sub does not. Use a real client library.
Rate limiter and lock are race-free (Lua/atomic ops where needed); lock release is safe (compare-and-delete); no check-then-set bugs.
INCR+TTL or sorted-set window; SET NX PX lock with unique token; list/Stream queue chosen and justified (Streams ack vs ephemeral pub/sub).
Explains lock failure modes / Redlock caveats and the delivery guarantees of the chosen queue.
Uses a real client library with connection pooling; works end-to-end.
Use this README structure to make the work reviewable.
DevPath fetches a read-only, size-capped snapshot. Submitted code is never executed.
# Atomic features: rate limiter, locks & a queue ## Goal Build three concurrency-sensitive features on Redis, getting atomicity right. (1) A RATE LIMITER — a per-user counter with a TTL (INCR + EXPIRE), or a sliding window via a sorted set / a Lua script to make it atomic. (2) A DISTRIBUTED LOCK using SET key value NX PX with a unique token and a safe release (compare-and-delete via Lua), and explain the failure modes (and that Redlock has caveats). (3) A simple work QUEUE using a list (LPUSH + BLPOP) OR a Stream with a consumer group + acknowledgments, and explain why Streams give at-least-once delivery that pub/sub does not. Use a real client library. ## Acceptance criteria - [ ] Atomicity: Rate limiter and lock are race-free (Lua/atomic ops where needed); lock release is safe (compare-and-delete); no check-then-set bugs. - [ ] Correct primitives: INCR+TTL or sorted-set window; SET NX PX lock with unique token; list/Stream queue chosen and justified (Streams ack vs ephemeral pub/sub). - [ ] Failure awareness: Explains lock failure modes / Redlock caveats and the delivery guarantees of the chosen queue. - [ ] Integration: Uses a real client library with connection pooling; works end-to-end. ## Verification - [ ] Document installation and run commands. - [ ] Record automated checks and their exact commands. - [ ] Add representative output, screenshots, or a short demo where useful. - [ ] Confirm failure paths and known constraints. ## Decision log ### Decision title - Context: - Choice: - Alternatives considered: - Tradeoffs: ## Evidence - Link each rubric criterion to the file, test, or artifact that demonstrates it. ## Known limitations - List what is intentionally out of scope and what should be improved next.