cache

package
v0.0.0-...-a7198d8 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: MIT Imports: 12 Imported by: 0

README

cache

cache 文件存放位置

Documentation

Index

Constants

View Source
const (
	// PrefixUserTokenCacheKey cache prefix
	PrefixUserTokenCacheKey = "user:token:%d"
	UserTokenExpireTime     = 24 * time.Hour * 30
)

Variables

View Source
var (
	// PrefixUserCacheKey cache prefix
	PrefixUserCacheKey = utils.ConcatString(prefix, "user:%d")
)

ProviderSet is cache providers.

Functions

This section is empty.

Types

type UserCache

type UserCache interface {
	SetUserCache(ctx context.Context, id int64, data *model.UserInfoModel, duration time.Duration) error
	GetUserCache(ctx context.Context, id int64) (data *model.UserInfoModel, err error)
	MultiGetUserCache(ctx context.Context, ids []int64) (map[string]*model.UserInfoModel, error)
	MultiSetUserCache(ctx context.Context, data []*model.UserInfoModel, duration time.Duration) error
	DelUserCache(ctx context.Context, id int64) error
	SetCacheWithNotFound(ctx context.Context, id int64) error
}

UserCache define cache interface

func NewUserCache

func NewUserCache(rdb *redis.Client) UserCache

NewUserCache new a cache

type UserTokenCache

type UserTokenCache interface {
	SetUserTokenCache(ctx context.Context, id int64, token string, duration time.Duration) error
	GetUserTokenCache(ctx context.Context, id int64) (token string, err error)
	DelUserTokenCache(ctx context.Context, id int64) error
}

UserToken define cache interface

func NewUserTokenCache

func NewUserTokenCache() UserTokenCache

NewUserTokenCache new a cache

Jump to

Keyboard shortcuts

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