cache

package
v0.0.0-...-c234f5e Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// 验证码发送频繁
	ErrCodeSendTooMany = errors.New("code send too many")
	// 发送验证码遇到未知错误
	ErrUnknownForCode         = errors.New("unknown error for code")
	ErrCodeVerifyTooManyTimes = errors.New("code verify too many times")
)
View Source
var ErrCacheMiss = errors.New("cache: miss")

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, inputCode string) (bool, error)
}

func NewCodeCache

func NewCodeCache(client redis.Cmdable) CodeCache

type RedisCodeCache

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

func (*RedisCodeCache) Set

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

func (*RedisCodeCache) Verify

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

type RedisUserCache

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

func (*RedisUserCache) Get

func (uc *RedisUserCache) Get(ctx context.Context, id int64) (domain.User, error)

func (*RedisUserCache) Set

func (uc *RedisUserCache) Set(ctx context.Context, user domain.User) error

type UserCache

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

func NewUserCache

func NewUserCache(cmd redis.Cmdable) UserCache

Directories

Path Synopsis
Package cachemocks is a generated GoMock package.
Package cachemocks is a generated GoMock package.
Package redismocks is a generated GoMock package.
Package redismocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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