redis

package
v0.0.0-...-62160e7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LikeCountSuffix = ":liked_count"
	HateCountSuffix = ":hated_count"
)
View Source
const CollectCountSuffix = ":collect_count"
View Source
const CommentCountSuffix = ":comment_count"
View Source
const ViewCountSuffix = ":view_count"

Variables

View Source
var (
	ExpireTime = time.Hour * 3
)

Functions

func InitRedis

func InitRedis()

Types

type Collect

type Collect struct{}

func (Collect) CheckCollectCt

func (c Collect) CheckCollectCt(aHashId string) (error, bool)

func (Collect) CollectCtAssign

func (c Collect) CollectCtAssign(aHashId string, count int64) error

func (Collect) CountCollect

func (c Collect) CountCollect(aHashId string) (error, int64)

func (Collect) DecrCollect

func (c Collect) DecrCollect(aHashId string) error

func (Collect) DelCollectCt

func (c Collect) DelCollectCt(aHashId string) error

func (Collect) GetCollectClient

func (c Collect) GetCollectClient() *redis.Client

func (Collect) IncrCollect

func (c Collect) IncrCollect(aHashId string) error

type Comment

type Comment struct{}

func (Comment) CheckCommentCt

func (c Comment) CheckCommentCt(aHashId string) (error, bool)

func (Comment) CommentCtAssign

func (c Comment) CommentCtAssign(aHashId string, count int64) error

func (Comment) CountComment

func (c Comment) CountComment(aHashId string) (error, int64)

func (Comment) DecrComment

func (c Comment) DecrComment(aHashId string) error

func (Comment) DelCommentCt

func (c Comment) DelCommentCt(aHashId string) error

func (Comment) GetCommentClient

func (c Comment) GetCommentClient() *redis.Client

func (Comment) IncrComment

func (c Comment) IncrComment(aHashId string) error

type Favorite

type Favorite struct{}

func (Favorite) CancerHate

func (f Favorite) CancerHate(uHashId, aHashId string) error

func (Favorite) CancerLike

func (f Favorite) CancerLike(uHashId, aHashId string) error

func (Favorite) CheckHate

func (f Favorite) CheckHate(aHashId string) (error, bool)

func (Favorite) CheckHateCt

func (f Favorite) CheckHateCt(aHashId string) (error, bool)

func (Favorite) CheckLike

func (f Favorite) CheckLike(aHashId string) (error, bool)

func (Favorite) CheckLikeCt

func (f Favorite) CheckLikeCt(aHashId string) (error, bool)

func (Favorite) CountHate

func (f Favorite) CountHate(aHashId string) (error, int64)

func (Favorite) CountLike

func (f Favorite) CountLike(aHashId string) (error, int64)

func (Favorite) DecrHate

func (f Favorite) DecrHate(aHashId string) error

func (Favorite) DecrLike

func (f Favorite) DecrLike(aHashId string) error

func (Favorite) ExistHate

func (f Favorite) ExistHate(uHashId, aHashId string) (error, bool)

func (Favorite) ExistLike

func (f Favorite) ExistLike(uHashId, aHashId string) (error, bool)

CheckLike 该用户对文章是否点赞

func (Favorite) GetFavoriteClient

func (f Favorite) GetFavoriteClient() *redis.Client

func (Favorite) Hate

func (f Favorite) Hate(uHashId, aHashId string) error

func (Favorite) HateCtAssign

func (f Favorite) HateCtAssign(aHashId string, count int64) error

func (Favorite) IncrHate

func (f Favorite) IncrHate(aHashId string) error

func (Favorite) IncrLike

func (f Favorite) IncrLike(aHashId string) error

文章点赞处理逻辑

func (Favorite) Like

func (f Favorite) Like(uHashId, aHashId string) error

func (Favorite) LikeCtAssign

func (f Favorite) LikeCtAssign(aHashId string, count int64) error

func (Favorite) TruncateHateStatus

func (f Favorite) TruncateHateStatus(aHashId string) error

func (Favorite) TruncateLikeStatus

func (f Favorite) TruncateLikeStatus(aHashId string) error

用户删除文章后,文章点赞依赖删除逻辑:

type View

type View struct{}

func (View) CheckViewCt

func (c View) CheckViewCt(aHashId string) (error, bool)

func (View) CountView

func (c View) CountView(aHashId string) (error, int64)

func (View) DecrView

func (c View) DecrView(aHashId string) error

func (View) DelViewCt

func (c View) DelViewCt(aHashId string) error

func (View) GetViewClient

func (c View) GetViewClient() *redis.Client

func (View) GetViewMap

func (c View) GetViewMap(aHashIds []string) (error, map[string]int64)

func (View) IncrView

func (c View) IncrView(aHashId string) error

func (View) ViewCtAssign

func (c View) ViewCtAssign(aHashId string, count int64) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL