Skip to content
a way to achieve distributed lock by redis module
C PHP Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE Update LICENSE Jan 9, 2020

jk jk jk jk


a way to achieve distributed lock by redis module


How to install

git clone
cd redlock
//and load the module in redis cli or add it into the conf
module load

How to use

  • slock.lock lock_key expire the comand lock will return result immediately ,you shall call lock in a while or give up locking
  • SLOCK.INFO key this command will return an array with two var, first is the client id and second is the time when client require the lock.
  • Slock.unlock key release the lock, if the lock wasn't been created by the same client, it will fail with 0.

PLEASE NOTE: The module does NOT support spin lock,use it carefully.

You can’t perform that action at this time.