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.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
tests
.gitignore
LICENSE Update LICENSE Jan 9, 2020
Makefile
README.md
slock.c
slock.h

README.md

jk jk jk jk

redlock

a way to achieve distributed lock by redis module

redis

How to install

git clone https://github.com/wujunwei/redlock
cd redlock
make
//and load the module in redis cli or add it into the conf
module load redlock.so

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.