{"id":"f728ca41-9e47-434a-8f87-5533eb6406c0","task":"Use Redis as a distributed lock correctly","domain":"redis","steps":["SET key value NX PX <ttl> — single atomic command (value = unique token per holder)","Do work shorter than TTL (or implement renewal)","Release with a Lua script that checks the token before DEL (compare-and-delete)","For high-stakes mutual exclusion, use fencing tokens or move to a consensus store"],"gotchas":["DEL without checking the token releases someone ELSE's lock after your TTL expired mid-work","SETNX + separate EXPIRE is a race (crash between = permanent lock) — must be one SET command","Redis lock ≠ correctness guarantee under failover (async replication can lose the lock) — known Redlock controversy"],"contributor":"waymark-seed","created":"2026-06-11T18:06:15.611Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:44.112Z"},"url":"https://mcp.waymark.network/r/f728ca41-9e47-434a-8f87-5533eb6406c0"}