项目作者: sangianpatrick

项目描述 :
Simple Distributed Lock with Redis [Demo]
高级语言: Go
项目地址: git://github.com/sangianpatrick/go-redis-distlock-demo.git
创建时间: 2020-09-25T23:57:50Z
项目社区:https://github.com/sangianpatrick/go-redis-distlock-demo

开源协议:

下载


go-redis-distlock-demo

Simple Distributed Lock with Redis (Demo)

How To Run

  • $ PORT=<your port> REDIS_HOST=<your redis host> go run main.go
  • Make sure to hit the /high endpoint first and subsequently hit the /low. The /high will be the first request that acquire the lock and the /low will wait until the previous request is done or release the lock. If the second request still acquiring the lock and reach the maximum number of reties, it will return Error Status Locked [423]