Here are battle-tested production implementations of key Redis architectural patterns with atomic safety. 1. Sliding Window Rate Limiter (Atomic Lua Script) Fixed counters suffer from "boundary burst" flaws (e.g. 100 requests at 00:59 and 100 at 01:01). A Sliding Window Log using Redis Sorted Sets ensures exact window rate limiting: 2. Distributed Locking (Redlock Safe Token Release) Distributed locking with SET resourcename myrandomvalue NX PX 30000 prevents multiple workers from processing the same order. To release safely without removing another worker's expired lock, use a Lua script: 3. Real-Time Leaderboard with Sorted Sets Leaderboards require high-speed score updates and ranking lookups. Sorted Sets (ZSET) store pairs of (member, score) sorted in O(log N):