A distributed lock looks deceptively simple. You have multiple instances of a service, but only one of them should perform a particular operation at a time. So you put a key in Redis: lock:invoice:123 = worker-1 If the key exists, another worker waits.

Source: [Dev.to](https://dev.to/serifcolakel/distributed-locks-in-go-correctness-failure-modes-and-production-patterns-4mdg)

Sponsored