cache

package
v0.0.0-...-88259fe Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCodeVerifyTooManyTime = errors.New("验证码错误次数过多")
	ErrCodeSendTooMany       = errors.New("验证码发送次数过多")
)
View Source
var (
	ErrKeyNotExist = redis.Nil
)

Functions

This section is empty.

Types

type CodeCache

type CodeCache interface {
	SetWithPhone(ctx context.Context, biz, phone, code string) error
	SetWithEmail(ctx context.Context, biz, email, code string) error
	VerifyWithPhone(ctx context.Context, biz, phone, code string) (bool, error)
	VerifyWithEmail(ctx context.Context, biz, email, code string) (bool, error)
}

func NewRedisCodeCache

func NewRedisCodeCache(client redis.Cmdable) CodeCache

type MemoryCodeCache

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

type RedisUserCache

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

func (*RedisUserCache) Get

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

func (*RedisUserCache) Set

func (r *RedisUserCache) Set(ctx context.Context, u domain.User) error

type UserCache

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

func NewRedisUserCache

func NewRedisUserCache(rdb redis.Cmdable) UserCache

Jump to

Keyboard shortcuts

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