cache

package
v0.0.0-...-10283fc Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2023 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
)
View Source
const (
	// PrefixUserCacheKey cache prefix
	PrefixUserCacheKey = "user:%d"
)

Variables

ProviderSet is cache providers.

Functions

This section is empty.

Types

type UserCache

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

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