61 lines
2.4 KiB
Go
61 lines
2.4 KiB
Go
package router
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"worktest/pkg/controller"
|
|
"worktest/pkg/controller/front"
|
|
)
|
|
|
|
//api路由配置
|
|
func RegisterRoute(router *gin.Engine) {
|
|
//middleware: 服务错误处理 => 生成请求id => access log
|
|
|
|
//api版本
|
|
v1 := router.Group("/api")
|
|
{
|
|
backend := v1.Group("/backend")
|
|
backend.POST("list", controller.List)
|
|
backend.POST("all/cache/remove", controller.RemoveAllCache)
|
|
backend.POST("cache/remove", controller.RemoveCache)
|
|
backend.POST("syn/cache", controller.SynCache)
|
|
}
|
|
|
|
{
|
|
backend := v1.Group("/front")
|
|
backend.POST("mysql/list", front.MysqlList) //数据库连接
|
|
backend.POST("redis/list", front.RedisList) //缓存连接 string/hash
|
|
backend.POST("redis/", controller.List) //缓存
|
|
backend.POST("getlist", controller.List) //mysql
|
|
|
|
// jemter 对比
|
|
backend.POST("mysql/detail", front.MysqlDetail) //数据库连接
|
|
backend.POST("redis/detail", front.RedisDetail) //redis单商品详情 无锁保护 可缓存击穿
|
|
backend.POST("redis/lock/detail", front.RedisDetailLock) //redis单商品详情 有锁保护 可缓存击穿
|
|
backend.POST("redis/bitmap/detail", front.RedisDetailBitMap) //redis单商品详情 锁保护 bitmap缓存击穿保护
|
|
backend.POST("redis/bitmapcount/detail", front.RedisDetailBitMapCount) //redis单商品详情 锁保护 bitmap缓存击穿保护 增加访问统计
|
|
|
|
//增加bitmap的统计等
|
|
backend.POST("redis/bitmapcount/productcount", front.RedisCountProduct) //redis单商品详情 锁保护 bitmap缓存击穿保护 增加访问统计
|
|
|
|
backend.POST("mysql/buy", front.MysqlBuy) //抢购 mysql事务
|
|
backend.POST("redis/tx/buy", front.RedisBuy) //redistab 事务抢购 watch unwatch mutile exec
|
|
backend.POST("redis/lock/buy", controller.List) //redistab 分布式锁抢购 setNx lua
|
|
backend.POST("gortout/buy", controller.List) //go语言锁抢购,协程模拟锁
|
|
backend.POST("getlist", controller.List) //go语言锁抢购
|
|
|
|
/*
|
|
|
|
backend.POST("getlist", controller.List) //推荐列表 list
|
|
backend.POST("getlist", controller.List) //推荐去除已买连接 set/zset
|
|
|
|
//jemter对比
|
|
backend.POST("getlist", controller.List) //websocket redistab 广播 receive
|
|
backend.POST("getlist", controller.List) //websocket redistab 广播 chain
|
|
backend.POST("getlist", controller.List) //websocket go通信 协程通信
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
}
|