cache

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PrefixUserBaseCacheKey cache前缀, 规则:业务+模块+{ID}
	PrefixUserBaseCacheKey = "eagle:user:base:%d"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache cache

func NewUserCache

func NewUserCache() *Cache

NewUserCache new一个用户cache

func (*Cache) DelUserBaseCache

func (c *Cache) DelUserBaseCache(ctx context.Context, userID uint64) error

DelUserBaseCache 删除用户cache

func (*Cache) GetUserBaseCache

func (c *Cache) GetUserBaseCache(ctx context.Context, userID uint64) (data *model.UserBaseModel, err error)

GetUserBaseCache 获取用户cache

func (*Cache) GetUserBaseCacheKey

func (c *Cache) GetUserBaseCacheKey(userID uint64) string

GetUserBaseCacheKey 获取cache key

func (*Cache) MultiGetUserBaseCache

func (c *Cache) MultiGetUserBaseCache(ctx context.Context, userIDs []uint64) (map[string]*model.UserBaseModel, error)

MultiGetUserBaseCache 批量获取用户cache

func (*Cache) SetCacheWithNotFound

func (c *Cache) SetCacheWithNotFound(ctx context.Context, userID uint64) error

SetCacheWithNotFound .

func (*Cache) SetUserBaseCache

func (c *Cache) SetUserBaseCache(ctx context.Context, userID uint64, user *model.UserBaseModel, duration time.Duration) error

SetUserBaseCache 写入用户cache

Jump to

Keyboard shortcuts

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