The RedLock algorithm for distributed locks based on Redis and its implementation in RedLock-Hyperf
Introduction Recently, the project required encapsulating a Redis distributed lock under the Hyperf framework, so I encapsulated the RedLock-Hyperf SDK based on the RedLock algorithm. Currently, in addition to supporting simple object calls, it also supports implementation through AOP annotations within the Hyperf framework. Implementing a distributed lock with Redis is probably not a difficult task for you. Most people use the setnx + expire + del commands to implement a simple distributed lock, but is such a mutex really secure? In this article, we will explore together the common implementations of Redis distributed locks and how the officially recommended RedLcok algorithm by Redis ensures the security of the lock. As a side note, although there are distributed locks implemented with Zookeeper and etcd besides Redis, these latter two options bring certain operational costs for a simple action of distributed...