链接:http://redis.io/topics/distlock
原理很简单,一段时间内轮询加锁的key
重点,不同语言的开源实现
Before describing the algorithm, here are a few links to implementations already available that can be used for reference.
Redlock-rb (Ruby 实现). There is also a fork of Redlock-rb that adds a gem for easy distribution and perhaps more.
Redlock-py (Python 实现).
Redlock-php (PHP 实现).
Redsync.go (Go 实现).
Redisson (Java 实现).
Redis::DistLock (Perl 实现).
Redlock-cpp (C++ 实现).
Redlock-cs (C#/.NET 实现).
node-redlock (NodeJS 实现). Includes support for lock extension.