cache

package
v0.0.0-...-048bef2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: MIT Imports: 13 Imported by: 0

README

cache

cache 文件存放位置

Documentation

Index

Constants

View Source
const (
	// PrefixCommentContentCacheKey cache prefix
	PrefixCommentContentCacheKey = "comment:content:%d"
)
View Source
const (
	// PrefixCommentHotCacheKey cache prefix
	PrefixCommentHotCacheKey = "comment:hot:%d"
)
View Source
const (
	// PrefixCommentIndexCacheKey cache prefix oid_type_sort
	PrefixCommentIndexCacheKey = "comment:index:%d_%d_%d"
)
View Source
const (
	// PrefixCommentInfoCacheKey cache prefix
	PrefixCommentInfoCacheKey = "comment:info:%d"
)
View Source
const (
	// PrefixCommentLatestCacheKey cache prefix
	PrefixCommentLatestCacheKey = "comment:latest:%d"
)
View Source
const (
	// PrefixPostInfoCacheKey cache prefix
	PrefixPostInfoCacheKey = "post:info:%d"
)
View Source
const (
	// PrefixUserCommentCacheKey cache prefix
	PrefixUserCommentCacheKey = "user:comment:%d"
)
View Source
const (
	// PrefixUserLikeCacheKey cache prefix
	PrefixUserLikeCacheKey = "user:like:%d"
)

Variables

ProviderSet is cache providers.

Functions

This section is empty.

Types

type CommentContentCache

type CommentContentCache interface {
	SetCommentContentCache(ctx context.Context, id int64, data *model.CommentContentModel, duration time.Duration) error
	GetCommentContentCache(ctx context.Context, id int64) (data *model.CommentContentModel, err error)
	MultiGetCommentContentCache(ctx context.Context, ids []int64) (map[int64]*model.CommentContentModel, error)
	MultiSetCommentContentCache(ctx context.Context, data []*model.CommentContentModel, duration time.Duration) error
	DelCommentContentCache(ctx context.Context, id int64) error
}

CommentContentCache define cache interface

func NewCommentContentCache

func NewCommentContentCache(rdb *redis.Client) CommentContentCache

NewCommentContentCache new a cache

type CommentHotCache

type CommentHotCache interface {
	SetCommentHotCache(ctx context.Context, id int64, data *model.CommentHotModel, duration time.Duration) error
	GetCommentHotCache(ctx context.Context, id int64) (data *model.CommentHotModel, err error)
	GetListCommentHotCache(ctx context.Context, postID int64, lastID int64, limit int) (ret []int64, err error)
	DelCommentHotCache(ctx context.Context, id int64) error
}

CommentHotCache define cache interface

func NewCommentHotCache

func NewCommentHotCache(rdb *redis.Client) CommentHotCache

NewCommentHotCache new a cache

type CommentIndexCache

type CommentIndexCache interface {
	SetCommentIndexCache(ctx context.Context, objID int64, objType int, sortType int, commentID int64, score float64, duration time.Duration) error
	GetListCommentIndexCache(ctx context.Context, objID int64, objType int, sortType int, lastID int64, limit int) (ret []int64, err error)
	MultiSetCommentIndexCache(ctx context.Context, objID int64, objType int, sortType int, cmtIDs []int64, scores []float64, duration time.Duration) error
	DelCommentIndexCache(ctx context.Context, objID int64, objType int, sortType int, cmtID int64) error
}

CommentIndexCache define cache interface

func NewCommentIndexCache

func NewCommentIndexCache(rdb *redis.Client) CommentIndexCache

NewCommentIndexCache new a cache

type CommentInfoCache

type CommentInfoCache interface {
	SetCommentInfoCache(ctx context.Context, id int64, data *model.CommentInfoModel, duration time.Duration) error
	GetCommentInfoCache(ctx context.Context, id int64) (data *model.CommentInfoModel, err error)
	MultiGetCommentInfoCache(ctx context.Context, ids []int64) (map[int64]*model.CommentInfoModel, error)
	MultiSetCommentInfoCache(ctx context.Context, data []*model.CommentInfoModel, duration time.Duration) error
	DelCommentInfoCache(ctx context.Context, id int64) error
}

CommentInfoCache define cache interface

func NewCommentInfoCache

func NewCommentInfoCache(rdb *redis.Client) CommentInfoCache

NewCommentInfoCache new a cache

type CommentLatestCache

type CommentLatestCache interface {
	SetCommentLatestCache(ctx context.Context, id int64, data *model.CommentLatestModel, duration time.Duration) error
	GetCommentLatestCache(ctx context.Context, id int64) (data *model.CommentLatestModel, err error)
	GetListCommentLatestCache(ctx context.Context, postID int64, lastID int64, limit int) (ret []int64, err error)
	DelCommentLatestCache(ctx context.Context, id int64) error
}

CommentLatestCache define cache interface

func NewCommentLatestCache

func NewCommentLatestCache(rdb *redis.Client) CommentLatestCache

NewCommentLatestCache new a cache

type PostInfoCache

type PostInfoCache interface {
	SetPostInfoCache(ctx context.Context, id int64, data *model.PostInfoModel, duration time.Duration) error
	GetPostInfoCache(ctx context.Context, id int64) (data *model.PostInfoModel, err error)
	MultiGetPostInfoCache(ctx context.Context, ids []int64) (map[int64]*model.PostInfoModel, error)
	MultiSetPostInfoCache(ctx context.Context, data []*model.PostInfoModel, duration time.Duration) error
	DelPostInfoCache(ctx context.Context, id int64) error
}

PostInfoCache define cache interface

func NewPostInfoCache

func NewPostInfoCache(rdb *redis.Client) PostInfoCache

NewPostInfoCache new a cache

type UserCommentCache

type UserCommentCache interface {
	SetUserCommentCache(ctx context.Context, id int64, data *model.UserCommentModel, duration time.Duration) error
	GetUserCommentCache(ctx context.Context, id int64) (data *model.UserCommentModel, err error)
	MultiGetUserCommentCache(ctx context.Context, ids []int64) (map[string]*model.UserCommentModel, error)
	MultiSetUserCommentCache(ctx context.Context, data []*model.UserCommentModel, duration time.Duration) error
	DelUserCommentCache(ctx context.Context, id int64) error
}

UserCommentCache define cache interface

func NewUserCommentCache

func NewUserCommentCache(rdb *redis.Client) UserCommentCache

NewUserCommentCache new a cache

type UserLikeCache

type UserLikeCache interface {
	SetUserLikeCache(ctx context.Context, id int64, data *model.UserLikeModel, duration time.Duration) error
	GetUserLikeCache(ctx context.Context, id int64) (data *model.UserLikeModel, err error)
	MultiGetUserLikeCache(ctx context.Context, ids []int64) (map[string]*model.UserLikeModel, error)
	MultiSetUserLikeCache(ctx context.Context, data []*model.UserLikeModel, duration time.Duration) error
	DelUserLikeCache(ctx context.Context, id int64) error
}

UserLikeCache define cache interface

func NewUserLikeCache

func NewUserLikeCache(rdb *redis.Client) UserLikeCache

NewUserLikeCache new a cache

Jump to

Keyboard shortcuts

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