Commit 1a40590d by wang

锁测试

parent ed7e60aa
Showing with 8 additions and 0 deletions
......@@ -11,6 +11,13 @@ ctx.JSON(200,nil)
}
func LockTest(ctx *gin.Context) {
defer delOnlyLock("test_lock")
addOnlyLock("test_lock")
ctx.JSON(200,"锁测试")
}
//如果锁不存在并设置锁
func addOnlyLock(key string){
redisWriteConn := gredis.Conn("search_w")
......
......@@ -27,5 +27,6 @@ func InitRouter() *gin.Engine {
controller.Open_Middleware("GetSkuListPrice"),controller.GetSkuListPrice)
//
r.GET("Test",controller.Error_Middleware("sku_query"),controller.TestRequest)
r.GET("LockTest",controller.Error_Middleware("sku_query"),controller.LockTest)
return r
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment