Skip to content

a way to achieve distributed lock by redis module

License

Notifications You must be signed in to change notification settings

jimmy-yu-1990/redlock

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

a way to achieve distributed lock by redis module

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 84.5%
  • PHP 7.8%
  • Makefile 7.7%