Documentation ¶
Index ¶
Constants ¶
View Source
const SEGLOCK_LENGTH = 100
Variables ¶
View Source
var Lock = new(SegLock)
Functions ¶
This section is empty.
Types ¶
type AddCatPopularityLogic ¶ added in v1.1.3
func NewAddCatPopularityLogic ¶ added in v1.1.3
func NewAddCatPopularityLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddCatPopularityLogic
func (*AddCatPopularityLogic) AddCatPopularity ¶ added in v1.1.3
func (l *AddCatPopularityLogic) AddCatPopularity(in *pb.AddCatPopularityReq) (*pb.AddCatPopularityResp, error)
type AddScoreLogic ¶ added in v1.1.3
func NewAddScoreLogic ¶ added in v1.1.3
func NewAddScoreLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddScoreLogic
func (*AddScoreLogic) AddScore ¶ added in v1.1.3
func (l *AddScoreLogic) AddScore(in *pb.AddScoreReq) (*pb.AddScoreResp, error)
type DailyUpdateLogic ¶ added in v1.1.3
func NewDailyUpdateLogic ¶ added in v1.1.3
func NewDailyUpdateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DailyUpdateLogic
func (*DailyUpdateLogic) DailyUpdate ¶ added in v1.1.3
func (l *DailyUpdateLogic) DailyUpdate(in *pb.DailyUpdateReq) (*pb.DailyUpdateResp, error)
type DoLikeLogic ¶
func NewDoLikeLogic ¶
func NewDoLikeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DoLikeLogic
func (*DoLikeLogic) DoLike ¶
func (l *DoLikeLogic) DoLike(in *pb.DoLikeReq) (*pb.DoLikeResp, error)
DoLike 点赞/取消赞
type GetLikedUsersLogic ¶ added in v1.1.5
func NewGetLikedUsersLogic ¶ added in v1.1.5
func NewGetLikedUsersLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetLikedUsersLogic
func (*GetLikedUsersLogic) GetLikedUsers ¶ added in v1.1.5
func (l *GetLikedUsersLogic) GetLikedUsers(in *pb.GetLikedUsersReq) (*pb.GetLikedUsersResp, error)
查看喜欢某个东西的用户
type GetTargetLikesLogic ¶
func NewGetTargetLikesLogic ¶
func NewGetTargetLikesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetTargetLikesLogic
func (*GetTargetLikesLogic) GetTargetLikes ¶
func (l *GetTargetLikesLogic) GetTargetLikes(in *pb.GetTargetLikesReq) (*pb.GetTargetLikesResp, error)
GetTargetLikes 获取目标点赞数
type GetTopKLogic ¶ added in v1.1.3
func NewGetTopKLogic ¶ added in v1.1.3
func NewGetTopKLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetTopKLogic
func (*GetTopKLogic) GetTopK ¶ added in v1.1.3
func (l *GetTopKLogic) GetTopK(in *pb.GetTopKReq) (*pb.GetTopKResp, error)
GetTopK
函数逻辑: Range == 1 时,直接从 Redis 访问当日数据 Range > 1 时,拼出 cacheKey 在 Redis 里取数据,若不存在,访问数据库提取数据入 Redis。 访问 Redis 前进行分段加锁,把 cacheKey hash 到一个数,作为 id ,对此 id 的锁加锁, 目的是过滤重复请求,相同请求同一时刻只有一个打入数据库,同时分段数量限制了最大数据库并发量,顺带缓解缓存雪崩问题
type GetUserLikeLogic ¶
func NewGetUserLikeLogic ¶
func NewGetUserLikeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserLikeLogic
func (*GetUserLikeLogic) GetUserLike ¶
func (l *GetUserLikeLogic) GetUserLike(in *pb.GetUserLikedReq) (*pb.GetUserLikedResp, error)
GetUserLike 获取用户是否点赞
type GetUserLikesLogic ¶ added in v1.1.5
func NewGetUserLikesLogic ¶ added in v1.1.5
func NewGetUserLikesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserLikesLogic
func (*GetUserLikesLogic) GetUserLikes ¶ added in v1.1.5
func (l *GetUserLikesLogic) GetUserLikes(in *pb.GetUserLikesReq) (*pb.GetUserLikesResp, error)
查看用户点赞列表
type ListCatPopularityLogic ¶ added in v1.1.3
func NewListCatPopularityLogic ¶ added in v1.1.3
func NewListCatPopularityLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListCatPopularityLogic
func (*ListCatPopularityLogic) ListCatPopularity ¶ added in v1.1.3
func (l *ListCatPopularityLogic) ListCatPopularity(in *pb.ListCatPopularityReq) (*pb.ListCatPopularityResp, error)
popularity
type ListTopCatLogic ¶ added in v1.1.3
func NewListTopCatLogic ¶ added in v1.1.3
func NewListTopCatLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListTopCatLogic
func (*ListTopCatLogic) ListTopCat ¶ added in v1.1.3
func (l *ListTopCatLogic) ListTopCat(in *pb.ListTopCatReq) (*pb.ListTopCatResp, error)
type SegLock ¶ added in v1.1.4
type SegLock [SEGLOCK_LENGTH]sync.Mutex
Source Files ¶
Click to show internal directories.
Click to hide internal directories.