cache

package
v0.0.0-...-2f866d2 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package cache 代表缓存

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCodeSendTooMany   = errors.New("发送太频繁")
	ErrCodeVerifyTooMany = errors.New("验证太频繁")
)
View Source
var ErrKeyNotExist = redis.Nil

Functions

This section is empty.

Types

type CodeCache

type CodeCache interface {
	Set(ctx context.Context, biz, phone, code string) error
	Verify(ctx context.Context, biz, phone, code string) (bool, error)
}

func NewCodeCache

func NewCodeCache(cmd redis.Cmdable) CodeCache

type RedisCodeCache

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

func (*RedisCodeCache) Set

func (c *RedisCodeCache) Set(ctx context.Context, biz, phone, code string) error

func (*RedisCodeCache) Verify

func (c *RedisCodeCache) Verify(ctx context.Context, biz, phone, code string) (bool, error)

type RedisUserCache

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

func (*RedisUserCache) Get

func (c *RedisUserCache) Get(ctx context.Context, uid int64) (domain.User, error)

func (*RedisUserCache) Set

func (c *RedisUserCache) Set(ctx context.Context, du domain.User) error

type UserCache

type UserCache interface {
	Get(ctx context.Context, uid int64) (domain.User, error)
	Set(ctx context.Context, du domain.User) error
}

func NewUserCache

func NewUserCache(cmd redis.Cmdable) UserCache

type UserCacheV1

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

Jump to

Keyboard shortcuts

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